Submission #1440745
Source Code Expand
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; 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]) <= 0) 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 | 1041 Byte |
Status | WA |
Exec Time | 205 ms |
Memory | 32340 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 | 190 ms | 28832 KB |
02.txt | WA | 187 ms | 28576 KB |
03.txt | WA | 195 ms | 30808 KB |
04.txt | WA | 189 ms | 32340 KB |
05.txt | WA | 169 ms | 27604 KB |
06.txt | WA | 169 ms | 29020 KB |
07.txt | WA | 182 ms | 28456 KB |
08.txt | WA | 176 ms | 29584 KB |
09.txt | WA | 205 ms | 28116 KB |
10.txt | WA | 185 ms | 30264 KB |
11.txt | WA | 140 ms | 27348 KB |
12.txt | WA | 181 ms | 28688 KB |
13.txt | WA | 167 ms | 28884 KB |
14.txt | WA | 167 ms | 27348 KB |
15.txt | AC | 150 ms | 30712 KB |
16.txt | WA | 199 ms | 30940 KB |
17.txt | WA | 187 ms | 30832 KB |
18.txt | AC | 69 ms | 18772 KB |
19.txt | AC | 68 ms | 21460 KB |
20.txt | AC | 68 ms | 21204 KB |
21.txt | AC | 68 ms | 18772 KB |
22.txt | AC | 83 ms | 22612 KB |
s1.txt | AC | 68 ms | 20564 KB |
s2.txt | AC | 67 ms | 18260 KB |