結果

問題 No.1425 Yet Another Cyclic Shifts Sorting
ユーザー たたき@競プロ
提出日時 2023-09-05 18:00:35
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 83 ms / 2,000 ms
コード長 744 bytes
コンパイル時間 5,237 ms
コンパイル使用メモリ 308,016 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-23 13:30:14
合計ジャッジ時間 9,682 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 48
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using mint=modint998244353; //1000000007;
using ll=long long;
using pp=pair<ll,ll>;
#define sr string 
#define vc vector
#define fi first
#define se second
#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define pque priority_queue
#define bpc(a) __builtin_popcount(a)
int main(){
  int n;cin>>n;
  vc<int>v(n); rep(i,n)cin>>v[i];
  int x=-1;
  rep(i,n-1)if(v[i]>v[i+1]){
    if(x!=-1){
      cout<<2;
      return 0;
    }
    x=i;
  }
  if(x==-1){
    cout<<0;
    return 0;
  }
  for(int i=x+1;i<n;i++){
    if(v[i]<=v[0])if(i+1==n||v[i+1]>=v[x]){
      cout<<1;
      return 0;
    }
  }
  cout<<2;
}
0