Submission #8345002
Source Code Expand
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = Integer.parseInt(sc.next()); int[] a1 = new int[n]; int[] a2 = new int[n]; a1[0] = Integer.parseInt(sc.next()); for(int i = 1; i < n; i++){ a1[i] = a1[i-1] + Integer.parseInt(sc.next()); } for(int i = 0; i < n; i++){ a2[i] = Integer.parseInt(sc.next()); } for(int i = n-2; i >= 0; i--){ a2[i] += a2[i+1]; } int max = 0; for(int i = 0; i < n; i++){ if(a1[i] + a2[i] > max){ max = a1[i] + a2[i]; } } System.out.println(max); } }
Submission Info
Submission Time | |
---|---|
Task | C - Candies |
User | Yuki_B |
Language | Java8 (OpenJDK 1.8.0) |
Score | 300 |
Code Size | 835 Byte |
Status | AC |
Exec Time | 108 ms |
Memory | 23636 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample01.txt, sample02.txt, sample03.txt, sample04.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, sample01.txt, sample02.txt, sample03.txt, sample04.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | AC | 99 ms | 21204 KB |
02.txt | AC | 99 ms | 19792 KB |
03.txt | AC | 97 ms | 19028 KB |
04.txt | AC | 107 ms | 18644 KB |
05.txt | AC | 96 ms | 18516 KB |
06.txt | AC | 92 ms | 19792 KB |
07.txt | AC | 90 ms | 21716 KB |
08.txt | AC | 91 ms | 19156 KB |
09.txt | AC | 96 ms | 19156 KB |
10.txt | AC | 97 ms | 19796 KB |
11.txt | AC | 108 ms | 21588 KB |
12.txt | AC | 107 ms | 19924 KB |
sample01.txt | AC | 90 ms | 18516 KB |
sample02.txt | AC | 90 ms | 19796 KB |
sample03.txt | AC | 91 ms | 21076 KB |
sample04.txt | AC | 89 ms | 23636 KB |