結果

問題 No.178 美しいWhitespace (1)
ユーザー Mcpu3Mcpu3
提出日時 2018-06-24 12:11:54
言語 Java21
(openjdk 21)
結果
AC  
実行時間 196 ms / 2,000 ms
コード長 435 bytes
コンパイル時間 3,314 ms
コンパイル使用メモリ 72,568 KB
実行使用メモリ 59,384 KB
最終ジャッジ日時 2023-09-13 13:35:48
合計ジャッジ時間 9,155 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,812 KB
testcase_01 AC 119 ms
55,640 KB
testcase_02 AC 120 ms
55,592 KB
testcase_03 AC 119 ms
55,524 KB
testcase_04 AC 192 ms
58,040 KB
testcase_05 AC 192 ms
59,384 KB
testcase_06 AC 193 ms
58,804 KB
testcase_07 AC 191 ms
58,040 KB
testcase_08 AC 192 ms
58,696 KB
testcase_09 AC 190 ms
58,356 KB
testcase_10 AC 191 ms
58,672 KB
testcase_11 AC 195 ms
58,740 KB
testcase_12 AC 191 ms
58,712 KB
testcase_13 AC 192 ms
58,880 KB
testcase_14 AC 194 ms
58,888 KB
testcase_15 AC 196 ms
58,440 KB
testcase_16 AC 191 ms
58,652 KB
testcase_17 AC 188 ms
58,228 KB
testcase_18 AC 191 ms
58,328 KB
testcase_19 AC 194 ms
58,508 KB
testcase_20 AC 192 ms
58,308 KB
testcase_21 AC 190 ms
58,164 KB
testcase_22 AC 186 ms
58,452 KB
testcase_23 AC 193 ms
58,596 KB
testcase_24 AC 195 ms
58,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class no178{
	public static void main(String[] args) {
		Scanner stdIn=new Scanner(System.in);
		long n=stdIn.nextLong(),a,b,s[]=new long[1000],m=0,t=0,ans=0;
		int i;
		for(i=0;i<n;i++) {
			a=stdIn.nextLong();
			b=stdIn.nextLong();
			s[i]+=a+4*b;
			if(m<s[i]) m=s[i];
		}
		for(i=0;i<n;i++) {
			if((m-s[i])%2!=0) t++;
			ans+=m-s[i];
		}
		System.out.print(t!=0?"-1":ans/2);
		
	}
}
0