結果
| 問題 |
No.178 美しいWhitespace (1)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-05-27 15:06:31 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 550 bytes |
| コンパイル時間 | 3,365 ms |
| コンパイル使用メモリ | 74,976 KB |
| 実行使用メモリ | 58,544 KB |
| 最終ジャッジ日時 | 2024-07-06 10:59:10 |
| 合計ジャッジ時間 | 7,434 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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);
}
}
}