結果
問題 | No.178 美しいWhitespace (1) |
ユーザー | tsunabit |
提出日時 | 2019-05-17 01:19:53 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 796 bytes |
コンパイル時間 | 3,955 ms |
コンパイル使用メモリ | 76,868 KB |
実行使用メモリ | 60,976 KB |
最終ジャッジ日時 | 2023-10-17 07:07:24 |
合計ジャッジ時間 | 10,174 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 134 ms
57,416 KB |
testcase_01 | AC | 133 ms
57,248 KB |
testcase_02 | AC | 136 ms
57,436 KB |
testcase_03 | AC | 134 ms
57,400 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | AC | 214 ms
59,964 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | AC | 213 ms
59,908 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | AC | 212 ms
60,004 KB |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | AC | 209 ms
59,832 KB |
testcase_24 | AC | 212 ms
59,540 KB |
ソースコード
import java.util.ArrayList; import java.util.Scanner; import java.util.Collections; public class No178 { public static void main(String[] args) { // 標準入力から読み込む際に、Scannerオブジェクトを使う。 Scanner s = new Scanner(System.in); int n = s.nextInt(); ArrayList<Integer> l = new ArrayList<Integer>(); // 𝑎+4𝑏+2𝑐 for(int i = 0; i < n; i++) { // a + 4b + 2c l.add(s.nextInt() + (4 * s.nextInt())); } Collections.sort(l, Collections.reverseOrder()); int o = 0; for(int v : l) { o += l.get(0) - v; } if(o % 2 == 0) { System.out.println(o / 2); }else { System.out.println(-1); } } }