結果
問題 | No.482 あなたの名は |
ユーザー | くれちー |
提出日時 | 2017-02-11 01:29:48 |
言語 | C90 (gcc 11.4.0) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 777 bytes |
コンパイル時間 | 512 ms |
コンパイル使用メモリ | 26,228 KB |
実行使用メモリ | 8,752 KB |
最終ジャッジ日時 | 2023-08-28 16:19:46 |
合計ジャッジ時間 | 4,536 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 0 ms
8,752 KB |
testcase_01 | AC | 1 ms
4,376 KB |
testcase_02 | AC | 1 ms
4,380 KB |
testcase_03 | AC | 0 ms
4,376 KB |
testcase_04 | AC | 1 ms
4,376 KB |
testcase_05 | AC | 1 ms
4,380 KB |
testcase_06 | AC | 1 ms
4,376 KB |
testcase_07 | AC | 1 ms
4,376 KB |
testcase_08 | AC | 1 ms
4,380 KB |
testcase_09 | AC | 1 ms
4,376 KB |
testcase_10 | AC | 1 ms
4,376 KB |
testcase_11 | AC | 0 ms
4,376 KB |
testcase_12 | AC | 1 ms
4,376 KB |
testcase_13 | AC | 0 ms
4,380 KB |
testcase_14 | AC | 1 ms
4,376 KB |
testcase_15 | TLE | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
ソースコード
#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) void swap(int *a, int *b) { int tmp = *a; *a = *b; *b = tmp; } int main() { long long n, k; scanf("%lld %lld", &n, &k); int d[200000], i, j; rep(i, n) scanf("%d", &d[i]); int ans = 0; rep(i, n) { if (d[i] != i + 1) { int idx; for (j = i; j < n; j++) { if (d[j] == i + 1) { idx = j; break; } } swap(&d[i], &d[idx]); ans++; } } if (k < ans || (k - ans) % 2) puts("NO"); else puts("YES"); return 0; }