# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
800482 | Dan4Life | 정렬하기 (IOI15_sorting) | C++17 | 227 ms | 23052 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int N = (int)2e5+10;
int n, a[N], p[N], vis[N];
bool chk(int m, int A[], int X[], int Y[], int P[], int Q[]){
for(int i = 0; i < n; i++) a[i] = A[i];
for(int i = 0; i < m; i++) swap(a[X[i]],a[Y[i]]), P[i]=Q[i]=0;
for(int i = 0; i < n; i++) p[a[i]]=i, vis[i]=0;
vector<array<int,2>> v; v.clear();
for(int i = 0; i < n; i++){
if(vis[i] or i==a[i]) continue; int j = i;
while(!vis[j]){
if(!vis[a[j]]) v.push_back({j,a[j]});
vis[j] = 1; j=a[j];
}
}
if(v.size()>m) return 0;
for(int i = 0; i < n; i++) a[i]=A[i], p[a[i]]=i;
for(int i = 0; i < m; i++){
swap(a[X[i]],a[Y[i]]), swap(p[a[X[i]]],p[a[Y[i]]]);
if(i<v.size()){
P[i] = p[v[i][0]], Q[i] = p[v[i][1]];
swap(a[P[i]],a[Q[i]]), swap(p[a[P[i]]],p[a[Q[i]]]);
}
}
return 1;
}
int findSwapPairs(int N, int A[], int m, int X[], int Y[], int P[], int Q[]) {
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |