結果
問題 |
No.482 あなたの名は
|
ユーザー |
![]() |
提出日時 | 2017-02-10 22:39:01 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 547 bytes |
コンパイル時間 | 769 ms |
コンパイル使用メモリ | 74,368 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-28 07:48:20 |
合計ジャッジ時間 | 2,934 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 15 WA * 13 |
ソースコード
#include<iostream> #include<algorithm> #include<cstdio> #include<cstdlib> #include<vector> #include<map> #include<queue> #include<string> #include<sstream> #include<cmath> #include<numeric> using namespace std; int main(){ long long int n, k; cin >> n >> k; vector<long long int> d(n); for(int i=0; i<n; i++) cin >> d[i]; int tmp = 0; for(int i=0; i<n; i++){ if( d[i] != i+1 ){ swap( d[i], d[ d[i]-1 ] ); tmp++; } } if( (k-tmp)%2 == 0 ) cout << "YES" << endl; else cout << "NO" << endl; return 0; }