結果

問題 No.1425 Yet Another Cyclic Shifts Sorting
ユーザー 👑 NachiaNachia
提出日時 2021-03-12 23:10:13
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 636 bytes
コンパイル時間 4,931 ms
コンパイル使用メモリ 257,760 KB
実行使用メモリ 6,656 KB
最終ジャッジ日時 2024-04-22 14:39:59
合計ジャッジ時間 6,354 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,248 KB
testcase_02 AC 1 ms
5,248 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 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 WA -
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 1 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 25 ms
5,632 KB
testcase_23 AC 7 ms
5,376 KB
testcase_24 AC 7 ms
5,376 KB
testcase_25 AC 28 ms
5,888 KB
testcase_26 AC 33 ms
6,400 KB
testcase_27 AC 28 ms
6,144 KB
testcase_28 AC 41 ms
6,400 KB
testcase_29 AC 11 ms
5,376 KB
testcase_30 AC 11 ms
5,376 KB
testcase_31 AC 41 ms
6,400 KB
testcase_32 AC 11 ms
5,376 KB
testcase_33 AC 3 ms
5,376 KB
testcase_34 AC 12 ms
5,376 KB
testcase_35 AC 41 ms
6,272 KB
testcase_36 AC 32 ms
5,376 KB
testcase_37 AC 8 ms
5,376 KB
testcase_38 AC 45 ms
6,400 KB
testcase_39 AC 3 ms
5,376 KB
testcase_40 AC 37 ms
6,016 KB
testcase_41 AC 15 ms
5,376 KB
testcase_42 AC 18 ms
5,376 KB
testcase_43 AC 4 ms
5,376 KB
testcase_44 AC 7 ms
5,376 KB
testcase_45 AC 48 ms
6,528 KB
testcase_46 AC 46 ms
6,656 KB
testcase_47 AC 46 ms
6,656 KB
testcase_48 AC 46 ms
6,400 KB
testcase_49 AC 49 ms
6,656 KB
testcase_50 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ull=unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)
using mll=atcoder::static_modint<1000000007>;

int N;
vector<int> A;
vector<pair<int,int>> Q;
vector<int> P;

int main(){
  scanf("%d",&N);
  A.resize(N);
  Q.resize(N);
  rep(i,N){ int a; scanf("%d",&a); A[i]=a; Q[i]={a,i}; }
  sort(Q.begin(),Q.end());
  P.resize(N);
  rep(i,N) P[i]=Q[i].second;
  int xp=-1; rep(i,N) if(P[i]!=i) xp=i;
  if(xp==-1){ printf("0\n"); return 0; }
  int ans=1;
  rep(i,xp) if((P[i]+1)%(xp+1)!=P[i+1]) ans=2;
  printf("%d\n",ans);
  return 0;
}
0