結果
| 問題 | No.178 美しいWhitespace (1) |
| コンテスト | |
| ユーザー |
matsuyoshi30
|
| 提出日時 | 2016-02-05 21:06:26 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 201 ms / 2,000 ms |
| コード長 | 599 bytes |
| コンパイル時間 | 1,937 ms |
| コンパイル使用メモリ | 74,732 KB |
| 実行使用メモリ | 43,536 KB |
| 最終ジャッジ日時 | 2024-09-21 20:41:37 |
| 合計ジャッジ時間 | 7,197 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 21 |
ソースコード
import java.util.Scanner;
class Test {
public static void main(String[] args) throws Exception {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
long[] w = new long[n];
long max = 0;
boolean bool = true;
for(int i=0; i<n; i++) {
int a = in.nextInt();
int b = in.nextInt();
w[i] = (long)a + b * 4;
max = Math.max(max, w[i]);
if(i > 0 && w[i] % 2 != w[i-1] % 2) {
bool = false;
}
}
if(bool) {
long ans = 0;
for(int i=0; i<n; i++) {
ans += (max - w[i]) / 2;
}
System.out.println(ans);
} else {
System.out.println(-1);
}
}
}
matsuyoshi30