提出 #3842331


ソースコード 拡げる

#include <cstdio>
#include <algorithm>

const int MAXN = 100005;

int a[MAXN];

int main() {
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    std::sort(a, a + n);

    int sg = 0;
    for (int i = 1; i <= n; i++) if ((a[i] - a[i - 1]) % 2) {
        sg ^= n - i + 1;
    }

    puts(sg ? "first" : "second");
    
    return 0;
}

提出情報

提出日時
問題 D - Harlequin
ユーザ Pepcy_Ch
言語 C++14 (GCC 5.4.1)
得点 500
コード長 390 Byte
結果 AC
実行時間 18 ms
メモリ 512 KiB

コンパイルエラー

./Main.cpp: In function ‘int main()’:
./Main.cpp:10:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
                    ^
./Main.cpp:11:52: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
                                                    ^

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 500 / 500
結果
AC × 2
AC × 22
セット名 テストケース
Sample a01, a02
All a01, a02, b03, b04, b05, b06, b07, b08, b09, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22
ケース名 結果 実行時間 メモリ
a01 AC 1 ms 128 KiB
a02 AC 1 ms 128 KiB
b03 AC 1 ms 128 KiB
b04 AC 1 ms 128 KiB
b05 AC 1 ms 128 KiB
b06 AC 1 ms 128 KiB
b07 AC 1 ms 128 KiB
b08 AC 1 ms 128 KiB
b09 AC 1 ms 128 KiB
b10 AC 1 ms 128 KiB
b11 AC 1 ms 128 KiB
b12 AC 9 ms 512 KiB
b13 AC 14 ms 512 KiB
b14 AC 14 ms 512 KiB
b15 AC 9 ms 512 KiB
b16 AC 18 ms 512 KiB
b17 AC 18 ms 512 KiB
b18 AC 18 ms 512 KiB
b19 AC 18 ms 512 KiB
b20 AC 18 ms 512 KiB
b21 AC 18 ms 512 KiB
b22 AC 18 ms 512 KiB