結果

問題 No.482 あなたの名は
ユーザー くれちー
提出日時 2017-02-10 22:34:53
言語 C90
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 476 bytes
コンパイル時間 408 ms
コンパイル使用メモリ 22,528 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-28 07:23:42
合計ジャッジ時間 2,105 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 16 WA * 12
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:12:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |     scanf("%lld %lld", &n, &k);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:16:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   16 |         scanf("%d", &d);
      |         ^~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define rep(i, n) for (i = 0; i < n; i++)
#define rrep(i, n) for (i = n; i >= 0; i--)
#define max(a, b) (a > b ? a : b)
#define min(a, b) (a < b ? a : b)

int main() {
    long long n, k;
    scanf("%lld %lld", &n, &k);

    int d, ans = 0, i;
    rep(i, n) {
        scanf("%d", &d);
        if (d != i + 1) ans++;
    }

    if (k - (ans - 1) % 2) puts("NO");
    else puts("YES");
    return 0;
}
0