結果
問題 | No.178 美しいWhitespace (1) |
ユーザー | matsuyoshi30 |
提出日時 | 2016-02-05 21:02:20 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 589 bytes |
コンパイル時間 | 2,026 ms |
コンパイル使用メモリ | 77,268 KB |
実行使用メモリ | 60,496 KB |
最終ジャッジ日時 | 2023-10-21 19:20:16 |
合計ジャッジ時間 | 7,875 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 129 ms
57,276 KB |
testcase_01 | AC | 130 ms
57,464 KB |
testcase_02 | AC | 128 ms
55,368 KB |
testcase_03 | AC | 131 ms
57,380 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | AC | 205 ms
59,588 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | AC | 198 ms
59,740 KB |
testcase_12 | AC | 204 ms
59,704 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | AC | 197 ms
59,856 KB |
testcase_19 | WA | - |
testcase_20 | AC | 208 ms
60,344 KB |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | AC | 189 ms
59,764 KB |
testcase_24 | AC | 200 ms
59,812 KB |
ソースコード
import java.util.Scanner; class Test { public static void main(String[] args) throws Exception { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] w = new int[n]; int max = 0; boolean bool = true; for(int i=0; i<n; i++) { int a = in.nextInt(); int b = in.nextInt(); w[i] = a + b * 4; max = Math.max(max, w[i]); if(i > 0 && w[i] % 2 != w[i-1] % 2) { bool = false; } } if(bool) { int ans = 0; for(int i=0; i<n; i++) { ans += (max - w[i]) / 2; } System.out.println(ans); } else { System.out.println(-1); } } }