結果
| 問題 |
No.178 美しいWhitespace (1)
|
| コンテスト | |
| ユーザー |
kou6839
|
| 提出日時 | 2015-04-16 01:44:21 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 552 bytes |
| コンパイル時間 | 1,946 ms |
| コンパイル使用メモリ | 78,992 KB |
| 実行使用メモリ | 43,984 KB |
| 最終ジャッジ日時 | 2024-07-04 14:50:07 |
| 合計ジャッジ時間 | 7,685 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 7 WA * 14 |
ソースコード
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;
}
int 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