結果

問題 No.178 美しいWhitespace (1)
ユーザー k_kadorak_kadora
提出日時 2015-05-27 15:06:31
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 550 bytes
コンパイル時間 3,546 ms
コンパイル使用メモリ 72,424 KB
実行使用メモリ 60,980 KB
最終ジャッジ日時 2023-09-20 15:54:33
合計ジャッジ時間 9,330 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,856 KB
testcase_01 AC 125 ms
55,972 KB
testcase_02 AC 126 ms
55,796 KB
testcase_03 AC 127 ms
55,656 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 196 ms
58,440 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 195 ms
59,084 KB
testcase_12 AC 198 ms
60,668 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 186 ms
58,604 KB
testcase_19 WA -
testcase_20 AC 196 ms
58,552 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 199 ms
58,824 KB
testcase_24 AC 197 ms
58,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class Whitespace{
	public static void main(String[] arg){
		Scanner sc = new Scanner(System.in);
		int n,max=0,sum=0,res = 0;
		n = sc.nextInt();
		int[] a = new int[n];
		int[] b = new int[n];
		for(int i = 0;i<n;i++){
			a[i] = sc.nextInt();
			b[i] = sc.nextInt();
			sum = sum + (a[i] % 2);
			if(a[i] + b[i]*4 >max)max = a[i] + b[i] * 4;
		}
		if(sum == n || sum == 0){
			for(int i = 0;i<n;i++){
				res = res + (max - (a[i] + b[i] *4))/2;
			}
			System.out.println(res);
		}else{
			System.out.println(-1);
		}
	}
}
0