結果
| 問題 | No.178 美しいWhitespace (1) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-02-22 16:58:05 |
| 言語 | Java (openjdk 27 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 117 ms / 2,000 ms |
| + 24µs | |
| コード長 | 927 bytes |
| 記録 | |
| コンパイル時間 | 2,331 ms |
| コンパイル使用メモリ | 86,156 KB |
| 実行使用メモリ | 49,596 KB |
| 最終ジャッジ日時 | 2026-10-09 17:21:34 |
| 合計ジャッジ時間 | 6,237 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 21 |
ソースコード
import java.util.*;
public class Run {
public static void main (String arg[]) {
Scanner scan = new Scanner(System.in);
int N = scan.nextInt();
int [] a = new int[N];
int [] b = new int[N];
long [] c = new long[N];
long ans = 0;
long max = 0;
int num = 0;
boolean x = false, y = false;
for (int i = 0; i < N; i++) {
a[i] = scan.nextInt();
b[i] = scan.nextInt();
if (a[i]%2==0) x = true;
else y = true;
if (x && y) break;
c[i] = a[i] + 4*b[i];
if (max < c[i]) {
num = i;
max = c[i];
}
}
for (int i = 0; i < N; i++) {
if (x && y) {
ans = -1;
break;
}
ans += (c[num] - c[i])/2;
}
System.out.println(ans);
}
}