結果
| 問題 | No.178 美しいWhitespace (1) |
| コンテスト | |
| ユーザー |
samplelpmas
|
| 提出日時 | 2016-11-15 13:06:29 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 830 bytes |
| 記録 | |
| コンパイル時間 | 2,771 ms |
| コンパイル使用メモリ | 84,008 KB |
| 実行使用メモリ | 47,352 KB |
| 最終ジャッジ日時 | 2026-05-20 13:54:46 |
| 合計ジャッジ時間 | 5,612 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 2 |
| other | AC * 7 WA * 14 |
ソースコード
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int lines = sc.nextInt();
int[] spaces = new int[lines];
int max = 0;
for (int i = 0; i < lines; i++) {
int tab = sc.nextInt();
int space = sc.nextInt();
spaces[i] = space + (4 * tab);
max = Math.max(max, spaces[i]);
}
long ideographicSpaces = 0;
for (int i = 0; i < lines; i++) {
int requiredSpaces = max - spaces[i];
if (requiredSpaces % 2 == 1) {
System.out.println(-1);
return;
}
ideographicSpaces += requiredSpaces / 2;
}
System.out.println(ideographicSpaces);
}
}
samplelpmas