結果
問題 | No.482 あなたの名は |
ユーザー |
|
提出日時 | 2017-02-10 22:48:23 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 68 ms / 2,000 ms |
コード長 | 413 bytes |
コンパイル時間 | 1,004 ms |
コンパイル使用メモリ | 71,424 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-29 20:17:45 |
合計ジャッジ時間 | 2,961 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
#include <iostream>#include <cstdio>#include <vector>#include <algorithm>using namespace std;int main() {int n;long long k;cin >> n >> k;vector<int> d(n, 0);for (int i = 0; i < n; i++) {cin >> d[i];d[i]--;}for (int i = 0; i < n; i++) {while (d[i] != i) {swap(d[i], d[d[i]]);k--;}}bool ok = (k >= 0 && k % 2 == 0);cout << (ok ? "YES" : "NO") << endl;return 0;}