| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 47528 | ngkan146 | 성질 급한 지학이 (IZhO13_crazy) | C++11 | 46 ms | 1236 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int test, n, a[1005];
int main(){
scanf("%d",&test);
while(test--){
scanf("%d",&n);
for(int i=1;i<=n;i++)
scanf("%d",&a[i]);
vector <int> ans;
for(int oldLady=1;oldLady<=n;oldLady++){
vector <int> peopleId;
peopleId.push_back(-1);
peopleId.push_back(oldLady);
for(int i=1;i<=n;i++) if (i != oldLady) peopleId.push_back(i);
//cerr << oldLady << endl;
int curSeat = a[1];
bool ok = 1;
for(int i=2;i<=n;i++){
//cerr << i << ' ' << curSeat << endl;
if (peopleId[i] == curSeat){
curSeat = a[i];
}
else{
if (a[i] != peopleId[i]){
ok = 0;
break;
}
}
}
if (ok) ans.push_back(oldLady);
}
assert(ans.size());
if (ans.size() > 1) cout << 0 << '\n';
else cout << ans[0] << '\n';
}
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
