結果

問題 No.482 あなたの名は
ユーザー hkrhkr
提出日時 2017-02-11 03:38:40
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,350 bytes
コンパイル時間 862 ms
コンパイル使用メモリ 95,908 KB
実行使用メモリ 4,860 KB
最終ジャッジ日時 2023-08-28 12:45:29
合計ジャッジ時間 2,609 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 WA -
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 22 ms
4,584 KB
testcase_16 AC 22 ms
4,688 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 22 ms
4,760 KB
testcase_20 WA -
testcase_21 AC 23 ms
4,760 KB
testcase_22 AC 22 ms
4,760 KB
testcase_23 AC 22 ms
4,572 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 22 ms
4,564 KB
testcase_28 AC 23 ms
4,720 KB
testcase_29 WA -
testcase_30 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#include<cassert>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define Endl endl

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);
  ll n,t;
  cin>>n>>t;
  vector<int> a(n);
  rep(i,n) cin>>a[i], --a[i];
  vector<int> usd(n);
  int sum=0;
  rep(i,n){
    if(usd[i]) continue;
    for(int j=0;usd[j]==0;j=a[j]) ++sum, usd[j]=1;
    --sum;
  }
  //out(sum,1);
  cout<<(sum<=t&&sum%2==t%2?"YES":"NO")<<endl;
  return 0;
}
0