結果
問題 | No.178 美しいWhitespace (1) |
ユーザー | yun_app |
提出日時 | 2016-05-12 13:08:36 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 95 ms / 2,000 ms |
コード長 | 998 bytes |
コンパイル時間 | 2,351 ms |
コンパイル使用メモリ | 75,896 KB |
実行使用メモリ | 38,524 KB |
最終ジャッジ日時 | 2024-04-15 15:17:48 |
合計ジャッジ時間 | 5,123 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 56 ms
36,864 KB |
testcase_01 | AC | 55 ms
37,060 KB |
testcase_02 | AC | 55 ms
36,568 KB |
testcase_03 | AC | 54 ms
36,572 KB |
testcase_04 | AC | 93 ms
38,440 KB |
testcase_05 | AC | 95 ms
38,524 KB |
testcase_06 | AC | 80 ms
37,908 KB |
testcase_07 | AC | 91 ms
38,364 KB |
testcase_08 | AC | 89 ms
38,140 KB |
testcase_09 | AC | 91 ms
38,072 KB |
testcase_10 | AC | 91 ms
37,860 KB |
testcase_11 | AC | 89 ms
37,888 KB |
testcase_12 | AC | 80 ms
37,844 KB |
testcase_13 | AC | 90 ms
38,180 KB |
testcase_14 | AC | 89 ms
38,392 KB |
testcase_15 | AC | 90 ms
38,184 KB |
testcase_16 | AC | 79 ms
38,008 KB |
testcase_17 | AC | 90 ms
38,068 KB |
testcase_18 | AC | 80 ms
38,032 KB |
testcase_19 | AC | 91 ms
37,892 KB |
testcase_20 | AC | 81 ms
37,916 KB |
testcase_21 | AC | 91 ms
38,044 KB |
testcase_22 | AC | 85 ms
38,112 KB |
testcase_23 | AC | 91 ms
38,212 KB |
testcase_24 | AC | 81 ms
38,156 KB |
ソースコード
/* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ class Ideone { public static void main (String[] args) throws java.lang.Exception { // your code goes here BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); long max = 0l; ArrayList<Long> sizes = new ArrayList<Long>(); for(int i=0;i<n;i++){ String[] lines = br.readLine().split(" "); long size = Long.parseLong(lines[0]) + Long.parseLong(lines[1])*4l; sizes.add(size); max = Math.max(max,size); } long ans = 0l; for(long l:sizes){ if((max-l)%2l!=0l){ System.out.println(-1); return; } ans += (max-l)/2l; } System.out.println(ans); } }