結果

問題 No.482 あなたの名は
ユーザー tsutajtsutaj
提出日時 2017-02-12 11:36:55
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,689 bytes
コンパイル時間 726 ms
コンパイル使用メモリ 94,824 KB
実行使用メモリ 5,264 KB
最終ジャッジ日時 2023-08-28 14:50:39
合計ジャッジ時間 3,030 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,852 KB
testcase_01 AC 3 ms
4,948 KB
testcase_02 AC 2 ms
4,864 KB
testcase_03 AC 3 ms
5,024 KB
testcase_04 AC 3 ms
4,860 KB
testcase_05 AC 2 ms
4,964 KB
testcase_06 AC 2 ms
4,948 KB
testcase_07 AC 3 ms
4,952 KB
testcase_08 AC 3 ms
4,868 KB
testcase_09 AC 3 ms
4,948 KB
testcase_10 AC 3 ms
4,896 KB
testcase_11 AC 2 ms
4,916 KB
testcase_12 AC 3 ms
5,012 KB
testcase_13 AC 3 ms
4,864 KB
testcase_14 WA -
testcase_15 AC 57 ms
5,020 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 57 ms
4,900 KB
testcase_19 AC 58 ms
5,016 KB
testcase_20 AC 57 ms
4,948 KB
testcase_21 AC 57 ms
5,180 KB
testcase_22 WA -
testcase_23 AC 57 ms
4,908 KB
testcase_24 AC 57 ms
4,864 KB
testcase_25 WA -
testcase_26 AC 57 ms
4,864 KB
testcase_27 WA -
testcase_28 AC 58 ms
4,936 KB
testcase_29 AC 55 ms
5,012 KB
testcase_30 AC 2 ms
5,028 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int const MOD = 1000000007;

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

signed main() {
    int n, k; cin >> n >> k;
    int d[200010] = {};
    rep(i,0,n) cin >> d[i];

    int cnt = 0;
    rep(i,0,n) {
        if(d[i] != i+1) cnt++;
    }
    if(cnt != 0) cnt = (cnt - 1) / 2 + 1;
    if(cnt <= k && cnt % 2 == k % 2) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}
0