Submission #183316
Source Code Expand
import static java.util.Arrays.deepToString; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.StringTokenizer; public class Main { private static final boolean isDebug = false; int N ; boolean[][] friends; int[][] flow; boolean[] loopChecked; void solve() throws Throwable { startTime = System.currentTimeMillis(); int[] a = readIntArray(); int[] b = readIntArray(); int sum = 0; for (int i = 0; i < a.length; i++) { if (a[i] < b[i]) { sum += b[i]; } else { sum += a[i]; } } pw.println(sum); } private static long gcd(long n1, long n2) { return (n2 == 0)?n1:gcd(n2, n1%n2); } private static int gcd(int n1, int n2) { return (n2 == 0)?n1:gcd(n2, n1%n2); } private int brPos = 0; private int[] brBuf = null; private final int readBufInt() throws IOException { if (brBuf == null || brBuf.length == brPos) { brBuf = readIntArray(); brPos = 0; return readBufInt(); } return brBuf[brPos++]; } private final int readInt() throws IOException { return Integer.parseInt(br.readLine()); } private final long readLong() throws IOException { return Long.parseLong(br.readLine()); } private final int[] readIntArray() throws IOException { String[] s = readStrArray(); int cnt = s.length; int[] out = new int[cnt]; for (int i = 0; i < cnt; i++) out[i] = Integer.parseInt(s[i]); return out; } private final char[] readCharArray() throws IOException { String[] s = readStrArray(); int cnt = s.length; char[] out = new char[cnt]; for (int i = 0; i < cnt; i++) out[i] = s[i].charAt(0); return out; } private final long[] readLongArray() throws IOException { String[] s = readStrArray(); int cnt = s.length; long[] out = new long[cnt]; for (int i = 0; i < cnt; i++) out[i] = Long.parseLong(s[i]); return out; } private final String[] readStrArray() throws IOException { // String[] s = br.readLine().split(" "); List<String> res = new ArrayList<String>(); StringTokenizer st = new StringTokenizer(br.readLine(), " "); while (st.hasMoreTokens()) { res.add(st.nextToken()); } return res.toArray(new String[0]); } static long startTime; public static void main(String[] args) { Main app = new Main(); try { app.br = new BufferedReader(new InputStreamReader(System.in)); app.solve(); } catch(Throwable e) { e.printStackTrace(); } finally { try { app.br.close();} catch (Exception igunore) {} } d(System.currentTimeMillis() - startTime + " ms"); pw.flush(); pw.close(); } static final void d(Object ... o) { if (isDebug) pw.println(deepToString(o)); } static final void d(int[][] oA) { for (int[] o : oA) { d(o); } } static final void d(boolean[][] oA) { for (boolean[] o : oA) { d(o); } } BufferedReader br = null; static PrintWriter pw = new PrintWriter(System.out); }
Submission Info
Submission Time | |
---|---|
Task | A - ゴールドラッシュ |
User | tochukaso |
Language | Java (OpenJDK 1.7.0) |
Score | 100 |
Code Size | 3711 Byte |
Status | AC |
Exec Time | 762 ms |
Memory | 20792 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 100 / 100 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | subtask0_sample-01.txt, subtask0_sample-02.txt, subtask0_sample-03.txt, subtask0_sample-04.txt |
All | subtask0_sample-01.txt, subtask0_sample-02.txt, subtask0_sample-03.txt, subtask0_sample-04.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask1_14.txt, subtask1_15.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
subtask0_sample-01.txt | AC | 472 ms | 20792 KB |
subtask0_sample-02.txt | AC | 441 ms | 20788 KB |
subtask0_sample-03.txt | AC | 428 ms | 20780 KB |
subtask0_sample-04.txt | AC | 418 ms | 20636 KB |
subtask1_01.txt | AC | 412 ms | 20652 KB |
subtask1_02.txt | AC | 433 ms | 20652 KB |
subtask1_03.txt | AC | 430 ms | 20660 KB |
subtask1_04.txt | AC | 440 ms | 20780 KB |
subtask1_05.txt | AC | 524 ms | 20788 KB |
subtask1_06.txt | AC | 433 ms | 20784 KB |
subtask1_07.txt | AC | 428 ms | 20660 KB |
subtask1_08.txt | AC | 762 ms | 20780 KB |
subtask1_09.txt | AC | 463 ms | 20644 KB |
subtask1_10.txt | AC | 448 ms | 20696 KB |
subtask1_11.txt | AC | 455 ms | 20656 KB |
subtask1_12.txt | AC | 434 ms | 20664 KB |
subtask1_13.txt | AC | 425 ms | 20664 KB |
subtask1_14.txt | AC | 430 ms | 20660 KB |
subtask1_15.txt | AC | 433 ms | 20668 KB |