Submission #1305877
Source Code Expand
import java.io.*; import java.math.*; import java.util.*; public class Main { private static boolean debug = false; private static boolean elapsed = false; private static PrintWriter _out = new PrintWriter(System.out); private static PrintWriter _err = new PrintWriter(System.err); private void solve(Scanner sc) { int N = sc.nextInt(); int[] A = new int[N]; long sum = 0; for (int i = 0; i < N; ++i) { A[i] = sc.nextInt(); sum += A[i] / 2; A[i] %= 2; } for (int i = 0; i < N - 1; ++i) { if (A[i] > 0 && A[i + 1] > 0) { --A[i]; --A[i + 1]; ++sum; } } _out.println(sum); } private static BigInteger C(long n, long r) { BigInteger res = BigInteger.ONE; for (long i = n; i > n - r; --i) { res = res.multiply(BigInteger.valueOf(i)); } for (long i = r; i > 1; --i) { res = res.divide(BigInteger.valueOf(i)); } return res; } private static BigInteger P(long n, long r) { BigInteger res = BigInteger.ONE; for (long i = n; i > n - r; --i) { res = res.multiply(BigInteger.valueOf(i)); } return res; } /* * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9 * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18 */ public static void main(String[] args) { long S = System.currentTimeMillis(); Scanner sc = new Scanner(System.in); new Main().solve(sc); _out.flush(); long G = System.currentTimeMillis(); if (elapsed) { _err.println((G - S) + "ms"); } _err.flush(); } }
Submission Info
Submission Time | |
---|---|
Task | B - Simplified mahjong |
User | unirita135 |
Language | Java8 (OpenJDK 1.8.0) |
Score | 0 |
Code Size | 1855 Byte |
Status | WA |
Exec Time | 464 ms |
Memory | 51040 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 400 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | s1.txt, s2.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, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, s1.txt, s2.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | WA | 463 ms | 46220 KB |
02.txt | WA | 444 ms | 50440 KB |
03.txt | WA | 462 ms | 50532 KB |
04.txt | WA | 438 ms | 47984 KB |
05.txt | WA | 398 ms | 49688 KB |
06.txt | WA | 415 ms | 49228 KB |
07.txt | WA | 464 ms | 46352 KB |
08.txt | WA | 436 ms | 48100 KB |
09.txt | WA | 451 ms | 47640 KB |
10.txt | WA | 461 ms | 47340 KB |
11.txt | AC | 356 ms | 48032 KB |
12.txt | AC | 451 ms | 46360 KB |
13.txt | AC | 431 ms | 46264 KB |
14.txt | AC | 453 ms | 48960 KB |
15.txt | AC | 369 ms | 51040 KB |
16.txt | WA | 449 ms | 50752 KB |
17.txt | WA | 453 ms | 46156 KB |
18.txt | AC | 92 ms | 20948 KB |
19.txt | AC | 91 ms | 19668 KB |
20.txt | AC | 92 ms | 19028 KB |
21.txt | AC | 92 ms | 21588 KB |
22.txt | AC | 91 ms | 22100 KB |
s1.txt | AC | 94 ms | 19668 KB |
s2.txt | AC | 92 ms | 21844 KB |