Submission #1856961
Source Code Expand
import java.util.ArrayList; import java.util.Scanner; public class Main { public static void main(String args[]){ Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int card[] = new int[n]; int total = 0; for (int i = 0;i < n;++i){ card[i] = scanner.nextInt(); total += card[i]; } long sub = card[0] * 2,i2 = Math.abs(total - sub); long i3; long sub2 = sub; for (int i = 0;i < n;++i){ sub += card[i] * 2; if((i3 = Math.abs(total - sub)) < i2){ i2 = i3; sub2 = sub; } } long a1 = (total - sub2 / 2); long a2 = total - a1; System.out.println(Math.abs(a1 - a2)); } }
Submission Info
Submission Time | |
---|---|
Task | C - Splitting Pile |
User | reik |
Language | Java8 (OpenJDK 1.8.0) |
Score | 0 |
Code Size | 827 Byte |
Status | WA |
Exec Time | 583 ms |
Memory | 82584 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 300 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 00_example_01.txt, 00_example_02.txt |
All | 00_example_01.txt, 00_example_02.txt, 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_example_01.txt | AC | 92 ms | 21588 KB |
00_example_02.txt | AC | 92 ms | 21844 KB |
01.txt | WA | 424 ms | 50236 KB |
02.txt | WA | 298 ms | 39940 KB |
03.txt | WA | 275 ms | 41556 KB |
04.txt | WA | 461 ms | 61228 KB |
05.txt | WA | 270 ms | 40328 KB |
06.txt | WA | 550 ms | 63688 KB |
07.txt | WA | 546 ms | 61612 KB |
08.txt | WA | 583 ms | 82584 KB |
09.txt | WA | 576 ms | 65464 KB |
10.txt | WA | 543 ms | 63712 KB |
11.txt | WA | 97 ms | 21588 KB |
12.txt | WA | 139 ms | 25576 KB |
13.txt | WA | 523 ms | 64028 KB |
14.txt | AC | 94 ms | 21716 KB |