結果

問題 No.100 直列あみだくじ
ユーザー crazybbb3crazybbb3
提出日時 2016-11-24 23:43:38
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,845 bytes
コンパイル時間 1,851 ms
コンパイル使用メモリ 77,640 KB
実行使用メモリ 37,224 KB
最終ジャッジ日時 2024-05-05 13:09:26
合計ジャッジ時間 5,510 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
37,176 KB
testcase_01 AC 46 ms
37,028 KB
testcase_02 AC 44 ms
37,176 KB
testcase_03 AC 44 ms
36,824 KB
testcase_04 WA -
testcase_05 AC 44 ms
36,696 KB
testcase_06 AC 44 ms
36,824 KB
testcase_07 AC 45 ms
36,928 KB
testcase_08 AC 45 ms
36,980 KB
testcase_09 AC 45 ms
37,136 KB
testcase_10 AC 46 ms
37,068 KB
testcase_11 AC 47 ms
37,224 KB
testcase_12 AC 48 ms
36,836 KB
testcase_13 AC 45 ms
36,936 KB
testcase_14 AC 46 ms
37,160 KB
testcase_15 AC 46 ms
36,968 KB
testcase_16 AC 44 ms
37,136 KB
testcase_17 AC 44 ms
37,136 KB
testcase_18 AC 49 ms
37,196 KB
testcase_19 AC 46 ms
36,844 KB
testcase_20 AC 46 ms
36,792 KB
testcase_21 AC 45 ms
36,972 KB
testcase_22 WA -
testcase_23 AC 46 ms
36,928 KB
testcase_24 AC 48 ms
36,972 KB
testcase_25 AC 46 ms
37,100 KB
testcase_26 AC 45 ms
36,716 KB
testcase_27 AC 47 ms
37,108 KB
testcase_28 AC 47 ms
36,628 KB
testcase_29 AC 48 ms
37,176 KB
testcase_30 AC 50 ms
37,028 KB
testcase_31 AC 47 ms
37,096 KB
testcase_32 WA -
testcase_33 AC 45 ms
37,028 KB
testcase_34 AC 46 ms
37,208 KB
testcase_35 AC 48 ms
36,680 KB
testcase_36 AC 52 ms
37,156 KB
testcase_37 AC 46 ms
37,176 KB
testcase_38 AC 47 ms
36,808 KB
testcase_39 AC 47 ms
36,972 KB
testcase_40 AC 46 ms
36,828 KB
testcase_41 AC 46 ms
37,120 KB
testcase_42 AC 46 ms
36,992 KB
testcase_43 AC 47 ms
36,836 KB
testcase_44 WA -
testcase_45 AC 47 ms
37,096 KB
testcase_46 AC 51 ms
37,196 KB
testcase_47 AC 47 ms
37,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    void solve() throws IOException {
        int n = ni();
        int[] a = nia(n);

        int cnt = 0;
        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j < n; j++) {
                if (a[i] > a[j]) cnt++;
            }
        }

        out.println(cnt % 2 == 0 ? "Yes" : "No");
    }

    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }

    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }

    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}
0