結果

問題 No.1425 Yet Another Cyclic Shifts Sorting
ユーザー chocoruskchocorusk
提出日時 2021-03-12 22:21:44
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 99 ms / 2,000 ms
コード長 1,078 bytes
コンパイル時間 3,263 ms
コンパイル使用メモリ 186,488 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-22 17:11:22
合計ジャッジ時間 6,296 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 1 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 1 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 1 ms
5,376 KB
testcase_22 AC 64 ms
5,376 KB
testcase_23 AC 18 ms
5,376 KB
testcase_24 AC 15 ms
5,376 KB
testcase_25 AC 68 ms
5,376 KB
testcase_26 AC 82 ms
5,376 KB
testcase_27 AC 72 ms
5,376 KB
testcase_28 AC 91 ms
5,376 KB
testcase_29 AC 26 ms
5,376 KB
testcase_30 AC 21 ms
5,376 KB
testcase_31 AC 88 ms
5,376 KB
testcase_32 AC 25 ms
5,376 KB
testcase_33 AC 4 ms
5,376 KB
testcase_34 AC 29 ms
5,376 KB
testcase_35 AC 86 ms
5,376 KB
testcase_36 AC 66 ms
5,376 KB
testcase_37 AC 15 ms
5,376 KB
testcase_38 AC 99 ms
5,376 KB
testcase_39 AC 4 ms
5,376 KB
testcase_40 AC 79 ms
5,376 KB
testcase_41 AC 30 ms
5,376 KB
testcase_42 AC 38 ms
5,376 KB
testcase_43 AC 6 ms
5,376 KB
testcase_44 AC 13 ms
5,376 KB
testcase_45 AC 95 ms
5,376 KB
testcase_46 AC 96 ms
5,376 KB
testcase_47 AC 99 ms
5,376 KB
testcase_48 AC 98 ms
5,376 KB
testcase_49 AC 96 ms
5,376 KB
testcase_50 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>
#include <atcoder/all>
#define popcount __builtin_popcount
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef pair<int, int> P;

int main()
{
    int n; cin>>n;
    int a[200020], as[200020];
    for(int i=0; i<n; i++) cin>>a[i];
    for(int i=0; i<n; i++) as[i]=a[i];
    sort(as, as+n);
    int t=-1;
    for(int i=n-1; i>=0; i--){
        if(a[i]!=as[i]){
            t=i;break;
        }
    }
    if(t==-1){
        cout<<0<<endl;return 0;
    }
    t++;
    int c=0;
    for(int i=0; i<t-1; i++) if(a[i]>a[i+1]) c++;
    if(c<=1 && a[0]>=a[t-1]) cout<<1<<endl;
    else cout<<2<<endl;
    return 0;
}
0