結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
54,128 KB
testcase_01 AC 127 ms
53,908 KB
testcase_02 AC 125 ms
54,136 KB
testcase_03 AC 115 ms
53,092 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 193 ms
56,596 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 199 ms
56,748 KB
testcase_12 AC 199 ms
56,672 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 201 ms
56,680 KB
testcase_19 WA -
testcase_20 AC 197 ms
56,652 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 199 ms
56,644 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();
		int[] a=new int[n];//space
		int[] b=new int[n];//tab
		int[] width=new int[n];
		int min=999999;
		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);
		}		
		int 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