Submission #3995012
Source Code Expand
import java.io.IOException; import java.util.NoSuchElementException; import java.io.InputStream; import java.io.PrintWriter; @SuppressWarnings("unchecked") public class Main { public static void main(String[] args) throws IOException { PrintWriter out = new PrintWriter(System.out); final int T = nextInt(); final int N = nextInt(); int[] A = new int[N]; for (int i = 0; i < N; i++) A[i] = nextInt(); final int M = nextInt(); int[] B = new int[M]; for (int i = 0; i < M; i++) B[i] = nextInt(); boolean flg = true; int ixp = 0; for (int ixt = 0; ixt < N; ixt++) { if (M - 1 < ixp) break; int dif = B[ixp] - A[ixt]; if (T < dif) continue; if (dif < 0) break; ixp++; } if (ixp != M) flg = false; out.println(flg ? "yes" : "no"); out.flush(); } // FastScanner start static final InputStream in = System.in; static final byte[] buffer = new byte[1024]; static int ptr = 0; static int buflen = 0; static boolean hasNextByte() { if (ptr < buflen) { return true; } else { ptr = 0; try { buflen = in.read(buffer); } catch (IOException e) { e.printStackTrace(); } if (buflen <= 0) { return false; } } return true; } static int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1; } static boolean isPrintableChar(int c) { return 33 <= c && c <= 126; } static boolean hasNext() { while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte(); } static String next() { if (!hasNext()) throw new NoSuchElementException(); StringBuilder sb = new StringBuilder(); int b = readByte(); while (isPrintableChar(b)) { sb.appendCodePoint(b); b = readByte(); } return sb.toString(); } static long nextLong() { if (!hasNext()) throw new NoSuchElementException(); long n = 0; boolean minus = false; int b = readByte(); if (b == '-') { minus = true; b = readByte(); } if (b < '0' || '9' < b) { throw new NumberFormatException(); } while (true) { if ('0' <= b && b <= '9') { n *= 10; n += b - '0'; } else if(b == -1 || !isPrintableChar(b)) { return minus ? -n : n; } else { throw new NumberFormatException(); } b = readByte(); } } static int nextInt() { long nl = nextLong(); if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException(); return (int) nl; } static double nextDouble() { return Double.parseDouble(next()); } // FastScanner end }
Submission Info
Submission Time | |
---|---|
Task | C - おいしいたこ焼きの売り方 |
User | ShinjiSHIBATA |
Language | Java8 (OpenJDK 1.8.0) |
Score | 100 |
Code Size | 3262 Byte |
Status | AC |
Exec Time | 74 ms |
Memory | 23124 KB |
Judge Result
Set Name | All | ||
---|---|---|---|
Score / Max Score | 100 / 100 | ||
Status |
|
Set Name | Test Cases |
---|---|
All | rand0.txt, rand1.txt, rand10.txt, rand11.txt, rand12.txt, rand13.txt, rand14.txt, rand15.txt, rand16.txt, rand17.txt, rand18.txt, rand19.txt, rand2.txt, rand20.txt, rand21.txt, rand22.txt, rand23.txt, rand24.txt, rand25.txt, rand26.txt, rand27.txt, rand28.txt, rand29.txt, rand3.txt, rand4.txt, rand5.txt, rand6.txt, rand7.txt, rand8.txt, rand9.txt, s1.txt, s2.txt, s3.txt, s4.txt, s5.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
rand0.txt | AC | 71 ms | 17748 KB |
rand1.txt | AC | 71 ms | 18132 KB |
rand10.txt | AC | 70 ms | 19284 KB |
rand11.txt | AC | 71 ms | 21204 KB |
rand12.txt | AC | 71 ms | 21204 KB |
rand13.txt | AC | 72 ms | 19028 KB |
rand14.txt | AC | 70 ms | 19156 KB |
rand15.txt | AC | 72 ms | 18132 KB |
rand16.txt | AC | 73 ms | 18772 KB |
rand17.txt | AC | 72 ms | 18772 KB |
rand18.txt | AC | 72 ms | 21076 KB |
rand19.txt | AC | 70 ms | 21332 KB |
rand2.txt | AC | 72 ms | 18260 KB |
rand20.txt | AC | 74 ms | 20948 KB |
rand21.txt | AC | 71 ms | 19284 KB |
rand22.txt | AC | 73 ms | 20948 KB |
rand23.txt | AC | 73 ms | 23124 KB |
rand24.txt | AC | 70 ms | 17492 KB |
rand25.txt | AC | 72 ms | 18644 KB |
rand26.txt | AC | 70 ms | 19796 KB |
rand27.txt | AC | 72 ms | 19156 KB |
rand28.txt | AC | 72 ms | 19924 KB |
rand29.txt | AC | 72 ms | 19156 KB |
rand3.txt | AC | 71 ms | 20692 KB |
rand4.txt | AC | 71 ms | 19284 KB |
rand5.txt | AC | 71 ms | 18132 KB |
rand6.txt | AC | 73 ms | 18644 KB |
rand7.txt | AC | 72 ms | 20564 KB |
rand8.txt | AC | 70 ms | 21204 KB |
rand9.txt | AC | 72 ms | 19156 KB |
s1.txt | AC | 72 ms | 19156 KB |
s2.txt | AC | 73 ms | 22484 KB |
s3.txt | AC | 71 ms | 17876 KB |
s4.txt | AC | 70 ms | 22996 KB |
s5.txt | AC | 70 ms | 21332 KB |