結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
54,020 KB
testcase_01 AC 127 ms
54,512 KB
testcase_02 AC 128 ms
53,908 KB
testcase_03 AC 126 ms
53,976 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 195 ms
56,516 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 198 ms
56,768 KB
testcase_12 AC 194 ms
56,496 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 191 ms
56,800 KB
testcase_19 WA -
testcase_20 AC 194 ms
56,460 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 200 ms
56,292 KB
testcase_24 AC 194 ms
56,408 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=999999999;
		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