結果
| 問題 | No.178 美しいWhitespace (1) |
| コンテスト | |
| ユーザー |
kou6839
|
| 提出日時 | 2015-04-16 01:45:21 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
AC
|
| 実行時間 | 119 ms / 2,000 ms |
| コード長 | 553 bytes |
| 記録 | |
| コンパイル時間 | 1,883 ms |
| コンパイル使用メモリ | 82,372 KB |
| 実行使用メモリ | 46,940 KB |
| 最終ジャッジ日時 | 2026-03-25 22:37:31 |
| 合計ジャッジ時間 | 5,298 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 21 |
ソースコード
import java.util.*;
public class Main {
public static void main(String[] args){
// TODO 自動生成されたメソッド・スタブ
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] space = new int[n];
int max=0;
for(int i=0;i<n;i++){
int a = sc.nextInt();
int b = sc.nextInt();
max=Math.max(max, a+b*4);
space[i]=a+b*4;
}
long ans=0;
for(int i=0;i<n;i++){
if( (max-space[i])%2!=0){
System.out.println(-1);
return;
}else{
ans+=(max-space[i])/2;
}
}
System.out.println(ans);
}
}
kou6839