# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
958562 | adaawf | 성질 급한 지학이 (IZhO13_crazy) | C++14 | 7 ms | 456 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
using namespace std;
int a[1005], dd[1005];
int main() {
int t;
cin >> t;
for (int jj = 0; jj < t; jj++) {
int n, c = 0, res = 0;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
for (int k = 1; k <= n; k++) {
int flag = 0;
for (int i = 1; i <= n; i++) dd[i] = 0;
dd[a[1]] = 1;
int j = 1;
for (int i = 1; i <= n; i++) {
if (i == k) continue;
j++;
if (dd[i] == 0 && a[j] != i) {
flag = 1;
break;
}
dd[a[j]] = 1;
}
if (flag == 0) {
c++;
res = k;
}
}
if (c > 1) cout << 0;
else cout << res;
cout << '\n';
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |