結果

問題 No.1425 Yet Another Cyclic Shifts Sorting
ユーザー 沙耶花沙耶花
提出日時 2021-03-12 21:51:39
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 591 bytes
コンパイル時間 4,948 ms
コンパイル使用メモリ 253,564 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-22 12:45:35
合計ジャッジ時間 7,618 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 WA -
testcase_12 AC 2 ms
6,944 KB
testcase_13 AC 2 ms
6,940 KB
testcase_14 AC 2 ms
6,940 KB
testcase_15 AC 2 ms
6,944 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 2 ms
6,944 KB
testcase_19 AC 2 ms
6,940 KB
testcase_20 AC 2 ms
6,944 KB
testcase_21 AC 2 ms
6,944 KB
testcase_22 AC 23 ms
6,940 KB
testcase_23 AC 8 ms
6,940 KB
testcase_24 AC 6 ms
6,944 KB
testcase_25 AC 25 ms
6,944 KB
testcase_26 AC 29 ms
6,944 KB
testcase_27 AC 27 ms
6,944 KB
testcase_28 AC 30 ms
6,944 KB
testcase_29 AC 11 ms
6,944 KB
testcase_30 AC 8 ms
6,940 KB
testcase_31 AC 30 ms
6,940 KB
testcase_32 AC 10 ms
6,940 KB
testcase_33 AC 3 ms
6,940 KB
testcase_34 AC 11 ms
6,940 KB
testcase_35 AC 28 ms
6,944 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000000

int main(){
	
	int N;
	cin>>N;
	
	vector<int> A(N);
	rep(i,N){
		scanf("%d",&A[i]);
	}
	
	int cur = 0;
	int ans = Inf;
	int m = 0;
	rep(i,N-1){
		if(A[i] > A[i+1])cur++;
		m = max(m,A[i]);
	}
	m = max(m,A.back());
	if(m==A.back())ans = cur;
	
	rep(i,N){
		if(A[i]>A[(i+1)%N])cur--;
		if(A[(i+N-1)%N]>A[i])cur++;
		ans = min(ans,cur+1);
	}
	
	cout<<ans<<endl;
	
    return 0;
}
0