Submission #1832909
Source Code Expand
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; Scanner in = new Scanner(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, Scanner in, PrintWriter out) { int n = in.nextInt(); long a[] = new long[n]; long ans = 0; for (int i = 0; i < n; i++) { a[i] = in.nextInt(); ans += a[i] / 2; a[i] %= 2; } long ans1 = 0, ans2 = 0; for (int i = 0; i < n - 1; i += 2) { if (a[i] == 1 && a[i + 1] == 1) { ans1++; a[i]--; a[i + 1]--; } } for (int i = 1; i < n - 1; i += 2) { if (a[i] == 1 && a[i + 1] == 1) { ans2++; a[i]--; a[i + 1]--; } } out.println(ans + Math.max(ans1, ans2)); } } }
Submission Info
Submission Time | |
---|---|
Task | B - Simplified mahjong |
User | aim_cpo |
Language | Java8 (OpenJDK 1.8.0) |
Score | 0 |
Code Size | 1519 Byte |
Status | WA |
Exec Time | 479 ms |
Memory | 63436 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 | 456 ms | 46192 KB |
02.txt | WA | 452 ms | 56652 KB |
03.txt | WA | 462 ms | 59396 KB |
04.txt | WA | 456 ms | 47656 KB |
05.txt | WA | 418 ms | 62316 KB |
06.txt | WA | 418 ms | 50112 KB |
07.txt | WA | 453 ms | 49172 KB |
08.txt | WA | 432 ms | 48224 KB |
09.txt | WA | 467 ms | 58120 KB |
10.txt | WA | 470 ms | 46512 KB |
11.txt | AC | 358 ms | 62204 KB |
12.txt | AC | 479 ms | 52468 KB |
13.txt | AC | 473 ms | 60804 KB |
14.txt | AC | 452 ms | 46224 KB |
15.txt | AC | 375 ms | 63436 KB |
16.txt | WA | 467 ms | 48656 KB |
17.txt | WA | 473 ms | 48284 KB |
18.txt | AC | 95 ms | 19412 KB |
19.txt | AC | 95 ms | 18900 KB |
20.txt | AC | 95 ms | 21204 KB |
21.txt | AC | 94 ms | 18644 KB |
22.txt | AC | 92 ms | 21844 KB |
s1.txt | AC | 94 ms | 21588 KB |
s2.txt | AC | 94 ms | 20564 KB |