結果

問題 No.178 美しいWhitespace (1)
ユーザー dazydazy
提出日時 2017-02-22 16:55:15
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 923 bytes
コンパイル時間 3,861 ms
コンパイル使用メモリ 74,156 KB
実行使用メモリ 61,220 KB
最終ジャッジ日時 2023-08-29 01:21:02
合計ジャッジ時間 10,561 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
56,060 KB
testcase_01 AC 125 ms
56,072 KB
testcase_02 AC 126 ms
56,192 KB
testcase_03 AC 126 ms
56,020 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 126 ms
55,880 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 126 ms
55,972 KB
testcase_12 AC 125 ms
56,028 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 124 ms
56,112 KB
testcase_19 WA -
testcase_20 AC 127 ms
55,736 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 195 ms
58,980 KB
testcase_24 AC 203 ms
59,776 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Run {
    public static void main (String arg[]) {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        int [] a = new int[N];
        int [] b = new int[N];
        int [] c = new int[N];
        int ans = 0;
        int max = 0;
        int num = 0;
        boolean x = false, y = false;

        for (int i = 0; i < N; i++) {
            a[i] = scan.nextInt();
            b[i] = scan.nextInt();

            if (a[i]%2==0) x = true;
            else y = true;
            if (x && y) break;

            c[i] = a[i] + 4*b[i];
            if (max < c[i]) {
                num = i;
                max = c[i];
            }
        }

        for (int i = 0; i < N; i++) {
            if (x && y) {
                ans = -1;
                break;
            }
            ans += (c[num] - c[i])/2;
        }

        System.out.println(ans);
    }
}
0