結果
| 問題 | No.178 美しいWhitespace (1) |
| コンテスト | |
| ユーザー |
htensai
|
| 提出日時 | 2020-05-13 11:55:10 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
AC
|
| 実行時間 | 123 ms / 2,000 ms |
| コード長 | 505 bytes |
| 記録 | |
| コンパイル時間 | 1,644 ms |
| コンパイル使用メモリ | 81,984 KB |
| 実行使用メモリ | 46,832 KB |
| 最終ジャッジ日時 | 2026-04-04 13:27:02 |
| 合計ジャッジ時間 | 5,342 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 21 |
ソースコード
import java.util.*;
public class Main {
public static void main (String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] arr = new int[n];
int max = 0;
for (int i = 0; i < n; i++) {
arr[i] = sc.nextInt() + sc.nextInt() * 4;
max = Math.max(max, arr[i]);
}
long count = 0;
for (int x : arr) {
if (x % 2 != max % 2) {
System.out.println(-1);
return;
}
count += (max - x) / 2;
}
System.out.println(count);
}
}
htensai