Submission #2123873
Source Code Expand
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * * @author palayutm */ public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new PrintWriter(outputStream); TaskB solver = new TaskB(); solver.solve(1, in, out); out.close(); } static class TaskB { public void solve(int testNumber, InputReader in, PrintWriter out) { int n = in.nextInt(); int[] a = in.nextIntArray(n); int[] b = in.nextIntArray(n); long sum = 0; for (int i = 0; i < n; i++) { if (a[i] > b[i]) { sum += a[i] - b[i]; } else { sum -= (b[i] - a[i]) / 2; } } out.println(sum > 0 ? "No" : "Yes"); } } static class InputReader { public BufferedReader reader; public StringTokenizer tokenizer; public InputReader(InputStream stream) { reader = new BufferedReader(new InputStreamReader(stream), 32768); tokenizer = null; } public String next() { while (tokenizer == null || !tokenizer.hasMoreTokens()) { try { tokenizer = new StringTokenizer(reader.readLine()); } catch (IOException e) { throw new RuntimeException(e); } } return tokenizer.nextToken(); } public int nextInt() { return Integer.parseInt(next()); } public int[] nextIntArray(int n) { int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = nextInt(); } return a; } } }
Submission Info
Submission Time | |
---|---|
Task | B - Two Arrays |
User | palayutm |
Language | Java8 (OpenJDK 1.8.0) |
Score | 300 |
Code Size | 2295 Byte |
Status | AC |
Exec Time | 134 ms |
Memory | 26064 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_000.txt, 0_001.txt, 0_002.txt |
All | 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 1_017.txt, 1_018.txt, 1_019.txt, 1_020.txt, 1_021.txt, 1_022.txt, 1_023.txt, 1_024.txt, 1_025.txt, 1_026.txt, 1_027.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_000.txt | AC | 71 ms | 18260 KB |
0_001.txt | AC | 71 ms | 20948 KB |
0_002.txt | AC | 70 ms | 20436 KB |
1_003.txt | AC | 116 ms | 25812 KB |
1_004.txt | AC | 120 ms | 23252 KB |
1_005.txt | AC | 127 ms | 23892 KB |
1_006.txt | AC | 117 ms | 23636 KB |
1_007.txt | AC | 125 ms | 23376 KB |
1_008.txt | AC | 132 ms | 24020 KB |
1_009.txt | AC | 127 ms | 25556 KB |
1_010.txt | AC | 132 ms | 22868 KB |
1_011.txt | AC | 127 ms | 26064 KB |
1_012.txt | AC | 129 ms | 23252 KB |
1_013.txt | AC | 123 ms | 23380 KB |
1_014.txt | AC | 116 ms | 21972 KB |
1_015.txt | AC | 130 ms | 23124 KB |
1_016.txt | AC | 124 ms | 25172 KB |
1_017.txt | AC | 128 ms | 25428 KB |
1_018.txt | AC | 127 ms | 23636 KB |
1_019.txt | AC | 127 ms | 20308 KB |
1_020.txt | AC | 129 ms | 25684 KB |
1_021.txt | AC | 129 ms | 25940 KB |
1_022.txt | AC | 124 ms | 24148 KB |
1_023.txt | AC | 124 ms | 25556 KB |
1_024.txt | AC | 115 ms | 25940 KB |
1_025.txt | AC | 134 ms | 22356 KB |
1_026.txt | AC | 116 ms | 23508 KB |
1_027.txt | AC | 126 ms | 25684 KB |