結果
問題 | No.1425 Yet Another Cyclic Shifts Sorting |
ユーザー |
![]() |
提出日時 | 2021-03-12 22:54:52 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 101 ms / 2,000 ms |
コード長 | 737 bytes |
コンパイル時間 | 1,879 ms |
コンパイル使用メモリ | 193,232 KB |
最終ジャッジ日時 | 2025-01-19 15:30:36 |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 48 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(int argc, char const *argv[]) { int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a.at(i); } int l = -1, r = -1; for (int i = 0; i < n - 1; i++) { if (a.at(i) > a.at(i + 1)) { if (l != -1) { cout << 2 << endl; return 0; } l = a.at(0); r = a.at(i); } if (l < a.at(i + 1) and a.at(i + 1) < r) { cout << 2 << endl; return 0; } } if (l == -1) { cout << 0 << endl; } else { cout << 1 << endl; } return 0; }