結果
| 問題 | No.178 美しいWhitespace (1) |
| コンテスト | |
| ユーザー |
Flere0114
|
| 提出日時 | 2016-02-24 12:41:20 |
| 言語 | Java (openjdk 26.0.2.1) |
| 結果 |
AC
|
| 実行時間 | 98 ms / 2,000 ms |
| + 687µs | |
| コード長 | 752 bytes |
| 記録 | |
| コンパイル時間 | 2,409 ms |
| コンパイル使用メモリ | 84,872 KB |
| 実行使用メモリ | 48,728 KB |
| 最終ジャッジ日時 | 2026-09-02 11:56:23 |
| 合計ジャッジ時間 | 6,303 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 21 |
ソースコード
import java.util.Scanner;
public class No178 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long max = 0, ans = 0;
int N;
N = Integer.parseInt(sc.next());
long[] a = new long[N];
long[] b = new long[N];
for (int i = 0; i < N; i++) {
a[i] = Long.parseLong(sc.next());
b[i] = Long.parseLong(sc.next());
max = Math.max(max, a[i] + 4 * b[i]);
}
for (int i = 0; i < N; i++) {
long po = max - (a[i] + 4 * b[i]);
if(po % 2 == 1){
System.out.println(-1);
return;
}
ans += po / 2;
}
System.out.println(ans);
}
}
Flere0114