結果
問題 | No.178 美しいWhitespace (1) |
ユーザー |
|
提出日時 | 2017-02-22 16:55:15 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 923 bytes |
コンパイル時間 | 3,258 ms |
コンパイル使用メモリ | 77,704 KB |
実行使用メモリ | 58,788 KB |
最終ジャッジ日時 | 2024-06-09 19:39:22 |
合計ジャッジ時間 | 8,016 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 122 ms
54,028 KB |
testcase_01 | AC | 105 ms
52,868 KB |
testcase_02 | AC | 112 ms
53,872 KB |
testcase_03 | AC | 116 ms
53,968 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | AC | 110 ms
53,692 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | AC | 102 ms
53,056 KB |
testcase_12 | AC | 101 ms
53,064 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | AC | 116 ms
55,868 KB |
testcase_19 | WA | - |
testcase_20 | AC | 112 ms
54,260 KB |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | AC | 186 ms
56,740 KB |
testcase_24 | AC | 184 ms
56,744 KB |
ソースコード
import java.util.*; public class Run { public static void main (String arg[]) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); int [] a = new int[N]; int [] b = new int[N]; int [] c = new int[N]; int ans = 0; int max = 0; int num = 0; boolean x = false, y = false; for (int i = 0; i < N; i++) { a[i] = scan.nextInt(); b[i] = scan.nextInt(); if (a[i]%2==0) x = true; else y = true; if (x && y) break; c[i] = a[i] + 4*b[i]; if (max < c[i]) { num = i; max = c[i]; } } for (int i = 0; i < N; i++) { if (x && y) { ans = -1; break; } ans += (c[num] - c[i])/2; } System.out.println(ans); } }