結果
| 問題 | No.482 あなたの名は |
| コンテスト | |
| ユーザー |
arrows
|
| 提出日時 | 2017-02-10 22:43:46 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 512 bytes |
| 記録 | |
| コンパイル時間 | 1,233 ms |
| コンパイル使用メモリ | 69,120 KB |
| 実行使用メモリ | 6,528 KB |
| 最終ジャッジ日時 | 2024-12-28 08:02:20 |
| 合計ジャッジ時間 | 3,170 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 18 WA * 10 |
ソースコード
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
int main()
{
ll N, K;
cin >> N >> K;
vector<ll> D(N), p(N);
for (ll i = 0; i < N; i++) {
cin >> D[i]; D[i]--;
p[D[i]] = i;
}
for (ll i = 0; i < N; i++) {
if (p[i] == i) continue;
swap(p[i], p[D[i]]);
K -= 1LL;
}
if (K < 0LL) {
cout << "NO" << endl;
} else {
cout << (K % 2 == 0 ? "YES" : "NO") << endl;
}
return 0;
}
arrows