結果

問題 No.178 美しいWhitespace (1)
ユーザー tsunabittsunabit
提出日時 2019-05-19 23:19:29
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 794 bytes
コンパイル時間 3,811 ms
コンパイル使用メモリ 76,148 KB
実行使用メモリ 60,332 KB
最終ジャッジ日時 2023-10-17 08:01:25
合計ジャッジ時間 10,014 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
57,132 KB
testcase_01 AC 135 ms
57,588 KB
testcase_02 AC 132 ms
57,512 KB
testcase_03 AC 135 ms
57,404 KB
testcase_04 AC 212 ms
60,064 KB
testcase_05 AC 215 ms
60,032 KB
testcase_06 AC 218 ms
59,744 KB
testcase_07 AC 215 ms
59,828 KB
testcase_08 AC 220 ms
59,836 KB
testcase_09 AC 211 ms
60,176 KB
testcase_10 AC 216 ms
60,008 KB
testcase_11 WA -
testcase_12 AC 217 ms
60,192 KB
testcase_13 AC 210 ms
59,924 KB
testcase_14 AC 218 ms
59,720 KB
testcase_15 AC 213 ms
60,280 KB
testcase_16 AC 214 ms
60,272 KB
testcase_17 AC 218 ms
59,888 KB
testcase_18 WA -
testcase_19 AC 216 ms
60,036 KB
testcase_20 AC 219 ms
59,876 KB
testcase_21 AC 217 ms
60,048 KB
testcase_22 AC 205 ms
60,332 KB
testcase_23 AC 215 ms
60,032 KB
testcase_24 AC 214 ms
59,700 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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<Long> l = new ArrayList<Long>();
        
        // 𝑎+4𝑏+2𝑐
        for(int i = 0; i < n; i++) {
            // a + 4b + 2c
        	l.add(s.nextLong() + (4 * s.nextLong()));
        }
        Collections.sort(l, Collections.reverseOrder());
        long o = 0;
        for(Long v : l) {
        	o += l.get(0) - v;
        }
        if(o % 2 == 0) {
        	System.out.println(o / 2);
        }else {
        	System.out.println(-1);
        }
    }
}
0