結果

問題 No.178 美しいWhitespace (1)
ユーザー kou6839kou6839
提出日時 2015-04-16 01:44:21
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 552 bytes
コンパイル時間 2,094 ms
コンパイル使用メモリ 71,304 KB
実行使用メモリ 59,012 KB
最終ジャッジ日時 2023-09-17 20:44:16
合計ジャッジ時間 8,090 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,600 KB
testcase_01 AC 124 ms
55,688 KB
testcase_02 AC 123 ms
55,696 KB
testcase_03 AC 124 ms
55,748 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 200 ms
58,544 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 198 ms
58,176 KB
testcase_12 AC 191 ms
58,612 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 194 ms
58,140 KB
testcase_19 WA -
testcase_20 AC 199 ms
58,628 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 189 ms
57,764 KB
testcase_24 AC 201 ms
58,344 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;


public class Main {
	public static void main(String[] args){
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] space = new int[n];
		int max=0;
		for(int i=0;i<n;i++){
			int a = sc.nextInt();
			int b = sc.nextInt();
			max=Math.max(max, a+b*4);
			space[i]=a+b*4;
		}
		int ans=0;
		for(int i=0;i<n;i++){
			if( (max-space[i])%2!=0){
				System.out.println(-1);
				return;
			}else{
				ans+=(max-space[i])/2;
			}
		}
		System.out.println(ans);
	}
}
0