結果
| 問題 |
No.178 美しいWhitespace (1)
|
| コンテスト | |
| ユーザー |
yun_app
|
| 提出日時 | 2016-05-12 13:08:36 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 89 ms / 2,000 ms |
| コード長 | 998 bytes |
| コンパイル時間 | 2,062 ms |
| コンパイル使用メモリ | 75,700 KB |
| 実行使用メモリ | 51,300 KB |
| 最終ジャッジ日時 | 2024-10-05 13:56:29 |
| 合計ジャッジ時間 | 4,936 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 21 |
ソースコード
/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
long max = 0l;
ArrayList<Long> sizes = new ArrayList<Long>();
for(int i=0;i<n;i++){
String[] lines = br.readLine().split(" ");
long size = Long.parseLong(lines[0]) + Long.parseLong(lines[1])*4l;
sizes.add(size);
max = Math.max(max,size);
}
long ans = 0l;
for(long l:sizes){
if((max-l)%2l!=0l){
System.out.println(-1);
return;
}
ans += (max-l)/2l;
}
System.out.println(ans);
}
}
yun_app