Submission #1832889
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++) { 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 | 1513 Byte |
Status | WA |
Exec Time | 490 ms |
Memory | 63168 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 | 480 ms | 62016 KB |
02.txt | WA | 474 ms | 59420 KB |
03.txt | WA | 470 ms | 58400 KB |
04.txt | WA | 435 ms | 63168 KB |
05.txt | WA | 425 ms | 61676 KB |
06.txt | WA | 429 ms | 62124 KB |
07.txt | WA | 452 ms | 58724 KB |
08.txt | WA | 481 ms | 62540 KB |
09.txt | WA | 475 ms | 57564 KB |
10.txt | WA | 482 ms | 59496 KB |
11.txt | AC | 424 ms | 57360 KB |
12.txt | AC | 486 ms | 50248 KB |
13.txt | AC | 490 ms | 60488 KB |
14.txt | AC | 470 ms | 61620 KB |
15.txt | AC | 378 ms | 60288 KB |
16.txt | WA | 482 ms | 45744 KB |
17.txt | WA | 477 ms | 58740 KB |
18.txt | AC | 96 ms | 21716 KB |
19.txt | AC | 96 ms | 16980 KB |
20.txt | AC | 97 ms | 21844 KB |
21.txt | AC | 97 ms | 23764 KB |
22.txt | AC | 98 ms | 21716 KB |
s1.txt | AC | 96 ms | 19028 KB |
s2.txt | AC | 97 ms | 17492 KB |