結果
| 問題 | No.482 あなたの名は |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-09-26 12:34:41 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 444 bytes |
| 記録 | |
| コンパイル時間 | 329 ms |
| コンパイル使用メモリ | 78,440 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2026-07-15 05:31:01 |
| 合計ジャッジ時間 | 2,388 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 18 WA * 10 |
ソースコード
#include <iostream>
using namespace std;
typedef long long LL;
int n, cnt;
LL k;
int main() {
scanf("%d%lld", &n, &k);
for (int i = 1, x; i <= n; ++i) {
scanf("%d", &x);
if (x != i) ++cnt;
}
if (k == 1) puts(cnt == 2 ? "YES" : "NO");
else if (k % 2 == 1) puts(cnt == 2 || (4 <= cnt && cnt <= k * 2) ? "YES" : "NO");
else puts(cnt == 0 || (3 <= cnt && cnt <= k * 2) ? "YES" : "NO");
return 0;
}