結果

問題 No.178 美しいWhitespace (1)
ユーザー 37zigen37zigen
提出日時 2016-03-31 15:46:10
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 604 bytes
コンパイル時間 1,948 ms
コンパイル使用メモリ 75,788 KB
実行使用メモリ 58,808 KB
最終ジャッジ日時 2024-04-10 06:47:43
合計ジャッジ時間 7,466 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 108 ms
52,956 KB
testcase_01 AC 119 ms
54,216 KB
testcase_02 AC 106 ms
53,028 KB
testcase_03 AC 107 ms
52,708 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 183 ms
56,348 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 197 ms
56,448 KB
testcase_12 AC 194 ms
56,832 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 189 ms
56,748 KB
testcase_19 WA -
testcase_20 AC 178 ms
56,740 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 188 ms
56,756 KB
testcase_24 AC 183 ms
56,572 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder178;
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		long[] a=new long[n];//space
		long[] b=new long[n];//tab
		long[] width=new long[n];
		long min=Long.MAX_VALUE;
		for(int i=0;i<n;i++){
			a[i]=sc.nextInt();
			b[i]=sc.nextInt();
			width[i]=a[i]+4*b[i];
			min=Math.min(width[i], min);
		}		
		long ans=0;
		for(int i=0;i<n;i++){
			width[i]-=min;
			if(width[i]%2==1){
				System.out.println(-1);
				return;
			}else{
				ans+=width[i]/2;
			}
		}
		System.out.println(ans);
	}
}
0