Submission #1832881
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(); int a[] = new int[n]; int ans = 0; for (int i = 0; i < n; i++) { a[i] = in.nextInt(); ans += a[i] / 2; a[i] %= 2; } int ans1 = 0, ans2 = 0; for (int i = 0; i < n - 1; i++) { if (a[i] == 1 && a[i + 1] == 1) { ans1++; a[i]--; a[i + 1]--; } } for (int i = 1; i < n - 1; i++) { 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 | 1509 Byte |
Status | WA |
Exec Time | 473 ms |
Memory | 52592 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 | 472 ms | 48748 KB |
02.txt | WA | 457 ms | 46168 KB |
03.txt | WA | 426 ms | 46412 KB |
04.txt | WA | 411 ms | 52592 KB |
05.txt | WA | 419 ms | 49384 KB |
06.txt | WA | 417 ms | 45316 KB |
07.txt | WA | 432 ms | 48124 KB |
08.txt | WA | 468 ms | 48212 KB |
09.txt | WA | 469 ms | 45308 KB |
10.txt | WA | 464 ms | 48192 KB |
11.txt | AC | 368 ms | 51500 KB |
12.txt | WA | 473 ms | 47796 KB |
13.txt | WA | 466 ms | 48588 KB |
14.txt | WA | 466 ms | 49800 KB |
15.txt | AC | 371 ms | 49284 KB |
16.txt | WA | 457 ms | 48564 KB |
17.txt | WA | 458 ms | 45280 KB |
18.txt | AC | 94 ms | 21076 KB |
19.txt | AC | 95 ms | 20688 KB |
20.txt | AC | 96 ms | 21332 KB |
21.txt | AC | 95 ms | 21588 KB |
22.txt | AC | 93 ms | 21972 KB |
s1.txt | AC | 95 ms | 21712 KB |
s2.txt | AC | 94 ms | 21972 KB |