Submission #1440746
Source Code Expand
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; public class Main { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); int t = Integer.parseInt(in.readLine()); int[] arr = new int[t]; for (int i = 0; i < t; i++) { arr[i] = Integer.parseInt(in.readLine()); } out.println(Solve(arr)); out.close(); in.close(); } private static int Solve(int[] arr) { int r = 0, mod[] = new int[arr.length]; // System.out.println(Arrays.toString(arr)); for (int i = 0; i < arr.length; i++) { if (arr[i] % 2 != 0) mod[i] = (i + 1); r += arr[i] / 2; } // Arrays.sort(mod); for (int i = 0; i < mod.length-1; i ++) if (Math.abs(arr[arr.length - 1 - i] - arr[arr.length - 2 - i]) <= 1) r++; // System.out.println(Arrays.toString(arr) + "\t\t" + Arrays.toString(mod)); return r; } }
Submission Info
Submission Time | |
---|---|
Task | B - Simplified mahjong |
User | vjudge1 |
Language | Java8 (OpenJDK 1.8.0) |
Score | 0 |
Code Size | 1019 Byte |
Status | WA |
Exec Time | 174 ms |
Memory | 32172 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 | 172 ms | 29268 KB |
02.txt | WA | 162 ms | 30632 KB |
03.txt | WA | 163 ms | 27092 KB |
04.txt | WA | 152 ms | 27092 KB |
05.txt | WA | 143 ms | 27312 KB |
06.txt | WA | 158 ms | 32172 KB |
07.txt | WA | 149 ms | 30424 KB |
08.txt | WA | 164 ms | 27992 KB |
09.txt | WA | 169 ms | 26596 KB |
10.txt | WA | 156 ms | 27220 KB |
11.txt | WA | 142 ms | 30292 KB |
12.txt | WA | 163 ms | 28116 KB |
13.txt | WA | 174 ms | 30676 KB |
14.txt | WA | 166 ms | 30676 KB |
15.txt | WA | 153 ms | 28500 KB |
16.txt | WA | 164 ms | 27988 KB |
17.txt | WA | 168 ms | 26796 KB |
18.txt | AC | 69 ms | 21332 KB |
19.txt | AC | 67 ms | 17620 KB |
20.txt | AC | 68 ms | 23124 KB |
21.txt | AC | 81 ms | 18388 KB |
22.txt | AC | 68 ms | 19156 KB |
s1.txt | WA | 68 ms | 17748 KB |
s2.txt | WA | 70 ms | 16980 KB |