結果

問題 No.178 美しいWhitespace (1)
ユーザー dazydazy
提出日時 2017-02-22 16:49:04
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 956 bytes
コンパイル時間 4,026 ms
コンパイル使用メモリ 74,996 KB
実行使用メモリ 60,396 KB
最終ジャッジ日時 2023-08-29 01:19:55
合計ジャッジ時間 8,898 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
56,312 KB
testcase_01 RE -
testcase_02 AC 119 ms
55,960 KB
testcase_03 AC 125 ms
55,964 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 121 ms
55,500 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 113 ms
55,652 KB
testcase_12 AC 119 ms
55,900 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 125 ms
55,964 KB
testcase_19 WA -
testcase_20 AC 121 ms
55,744 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 197 ms
58,116 KB
testcase_24 AC 195 ms
56,136 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 = -1;
        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