結果
問題 | No.178 美しいWhitespace (1) |
ユーザー | htensai |
提出日時 | 2020-05-13 11:53:59 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 504 bytes |
コンパイル時間 | 2,146 ms |
コンパイル使用メモリ | 71,776 KB |
実行使用メモリ | 60,440 KB |
最終ジャッジ日時 | 2023-10-12 16:56:00 |
合計ジャッジ時間 | 8,026 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 123 ms
56,036 KB |
testcase_01 | AC | 119 ms
55,784 KB |
testcase_02 | AC | 118 ms
56,144 KB |
testcase_03 | AC | 118 ms
55,784 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | AC | 192 ms
58,432 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | AC | 192 ms
58,336 KB |
testcase_12 | AC | 194 ms
58,800 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | AC | 191 ms
57,972 KB |
testcase_19 | WA | - |
testcase_20 | AC | 193 ms
58,272 KB |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | AC | 192 ms
58,668 KB |
testcase_24 | AC | 197 ms
58,656 KB |
ソースコード
import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] arr = new int[n]; int max = 0; for (int i = 0; i < n; i++) { arr[i] = sc.nextInt() + sc.nextInt() * 4; max = Math.max(max, arr[i]); } int count = 0; for (int x : arr) { if (x % 2 != max % 2) { System.out.println(-1); return; } count += (max - x) / 2; } System.out.println(count); } }