Submission #62022294


Source Code Expand

#include <bits/stdc++.h>
using namespace std;

#define all(v) v.begin(),v.end()
#define resort(v) sort(v.rbegin(),v.rend())
using ll = long long;
using ull = unsigned long long;
using vll=vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll,ll>;
using vp=vector<pair<ll, ll>>;

const ll inf=1ll<<60;
#define mod10 (ll)1e9+7
#define mod99 (ll)998244353
const double PI = acos(-1);

#define rep(i,n) for (ll i=0;i<n;++i)
#define per(i,n) for(ll i=n-1;i>=0;--i)
#define rep2(i,a,n) for (ll i=a;i<n;++i)
#define per2(i,a,n) for (ll i=n-1;i>=a;--i)


template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }

ll dx[] = {1, 0, -1, 0, -1, 1, -1, 1};
ll dy[] = {0, 1, 0, -1, -1, 1, 1, -1};

void solve() {
    int a[5];
    int n = 5;
    rep(i, n) cin >> a[i];

    rep(i, 4) {
        swap(a[i], a[i+1]);
        bool flag = true;
        rep(j, 5) {
            if (a[j] != j+1) flag = false;
        }
        if(flag) { 
            cout << "Yes\n";
            return;
        }
        swap(a[i], a[i+1]);
    }
    cout << "No\n";
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int t=1;
    // cin >> t;
    while(t--)solve();
}

Submission Info

Submission Time
Task A - 12435
User ardRiriy
Language C++ 20 (gcc 12.2)
Score 150
Code Size 1350 Byte
Status AC
Exec Time 1 ms
Memory 3596 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 150 / 150
Status
AC × 4
AC × 15
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_handmade_00.txt, 01_handmade_01.txt, 01_handmade_02.txt, 02_Yes_00.txt, 02_Yes_01.txt, 03_No_00.txt, 03_No_01.txt, 03_No_02.txt, 03_No_03.txt, 03_No_04.txt, 03_No_05.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3388 KiB
00_sample_01.txt AC 1 ms 3392 KiB
00_sample_02.txt AC 1 ms 3384 KiB
00_sample_03.txt AC 1 ms 3464 KiB
01_handmade_00.txt AC 1 ms 3476 KiB
01_handmade_01.txt AC 1 ms 3456 KiB
01_handmade_02.txt AC 1 ms 3388 KiB
02_Yes_00.txt AC 1 ms 3408 KiB
02_Yes_01.txt AC 1 ms 3460 KiB
03_No_00.txt AC 1 ms 3448 KiB
03_No_01.txt AC 1 ms 3460 KiB
03_No_02.txt AC 1 ms 3388 KiB
03_No_03.txt AC 1 ms 3416 KiB
03_No_04.txt AC 1 ms 3592 KiB
03_No_05.txt AC 1 ms 3596 KiB