結果

問題 No.1425 Yet Another Cyclic Shifts Sorting
ユーザー tkmst201tkmst201
提出日時 2021-05-02 21:49:29
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 963 bytes
コンパイル時間 2,241 ms
コンパイル使用メモリ 199,576 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-28 12:31:22
合計ジャッジ時間 8,015 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
template<typename A, typename B> inline bool chmax(A & a, const B & b) { if (a < b) { a = b; return true; } return false; }
template<typename A, typename B> inline bool chmin(A & a, const B & b) { if (a > b) { a = b; return true; } return false; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = false;
//---------------------------------//

int main() {
	int N;
	cin >> N;
	vector<int> A(N);
	REP(i, N) scanf("%d", &A[i]);
	
	if (is_sorted(ALL(A))) { puts("0"); return 0; }
	
	int p = 0;
	while (A[p] <= A[p + 1]) ++p;
	
	bool ok = A[0] >= A[p + 1];
	int p2 = p + 2;
	ok &= A[p] <= A[p2];
	while (p2 + 1 < N && A[p2] <= A[p2 + 1]) ++p2;
	ok &= p2 + 1 == N;
	
	if (ok) puts("1");
	else puts("2");
}
0