結果
問題 | No.178 美しいWhitespace (1) |
ユーザー | mits58 |
提出日時 | 2016-07-02 15:18:21 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 466 bytes |
コンパイル時間 | 1,934 ms |
コンパイル使用メモリ | 75,024 KB |
実行使用メモリ | 57,132 KB |
最終ジャッジ日時 | 2024-04-20 05:48:12 |
合計ジャッジ時間 | 7,599 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 126 ms
54,032 KB |
testcase_01 | AC | 127 ms
54,128 KB |
testcase_02 | AC | 125 ms
54,016 KB |
testcase_03 | AC | 124 ms
54,240 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | AC | 198 ms
56,948 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | AC | 199 ms
57,000 KB |
testcase_12 | AC | 195 ms
56,428 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | AC | 196 ms
56,528 KB |
testcase_19 | WA | - |
testcase_20 | AC | 197 ms
56,268 KB |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | AC | 196 ms
56,492 KB |
testcase_24 | AC | 196 ms
56,504 KB |
ソースコード
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); while(sc.hasNext()){ int n=sc.nextInt(); int[] c=new int[n]; int max=0; for(int i=0;i<n;i++){ c[i]=sc.nextInt()+sc.nextInt()*4; max=Math.max(c[i],max); } int ans=0; for(int i=0;i<n;i++){ if(ans==-1) break; if((max-c[i])%2==1) ans=-1; else ans+=(max-c[i])/2; } System.out.println(ans); } } }