# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1119026 | Tsagana | Crazy old lady (IZhO13_crazy) | C++14 | 10 ms | 596 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false);cin.tie();cout.tie();
using namespace std;
void solve () {
int a[1001];
int s[1001];
int r = 0;
int n; cin >> n;
for (int i = 0; i < n; i++) cin >> a[i];
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) s[j] = 0;
s[a[0]] = 1;
int j; for (j = 1; j < n; j++) {
int k = j + (j >= i ? 1 : 0);
if (!s[k] && a[j] != k) break;
s[a[j]] = 1;
}
if (j == n) r = (r ? -1 : i);
}
cout << max(r, 0) << '\n';
}
int main() {IOS int t; cin >> t; while (t--) solve(); return 0;}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |