結果
| 問題 |
No.1425 Yet Another Cyclic Shifts Sorting
|
| コンテスト | |
| ユーザー |
SSRS
|
| 提出日時 | 2021-03-12 21:52:58 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 599 bytes |
| コンパイル時間 | 1,700 ms |
| コンパイル使用メモリ | 171,240 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-14 12:14:57 |
| 合計ジャッジ時間 | 4,707 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 43 WA * 5 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
int N;
cin >> N;
vector<int> A(N);
for (int i = 0; i < N; i++){
cin >> A[i];
}
vector<int> p;
for (int i = 0; i < N - 1; i++){
if (A[i] > A[i + 1]){
p.push_back(i);
}
}
if (p.empty()){
cout << 0 << endl;
} else if (p.size() == 1){
bool ok = true;
for (int i = p[0] + 1; i < N - 1; i++){
if (A[i] > A[p[0]] && A[i + 1] < A[p[0]]){
ok = false;
}
}
if (ok){
cout << 1 << endl;
} else {
cout << 2 << endl;
}
} else {
cout << 2 << endl;
}
}
SSRS