結果
| 問題 | No.178 美しいWhitespace (1) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-05-27 15:06:31 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 550 bytes |
| 記録 | |
| コンパイル時間 | 2,195 ms |
| コンパイル使用メモリ | 84,276 KB |
| 実行使用メモリ | 48,496 KB |
| 最終ジャッジ日時 | 2026-08-09 13:16:04 |
| 合計ジャッジ時間 | 6,422 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 7 WA * 14 |
ソースコード
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);
}
}
}