# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1108011 | 2024-11-02T14:53:53 Z | Aviansh | 정렬하기 (IOI15_sorting) | C++17 | 85 ms | 77644 KB |
#include "sorting.h" #include <bits/stdc++.h> using namespace std; int findSwapPairs(int n, int s[], int m, int x[], int y[], int p[], int q[]) { int be[n]; iota(be,be+n,0); int ber[m][n]; for(int i = m-1;i>=0;i--){ if(x[i]!=y[i]) swap(be[x[i]],be[y[i]]); int temp[n]; for(int i = 0;i<n;i++){ temp[be[i]]=i; } copy(temp,temp+n,ber[i]); } int r = 0; for(int i = 0;i<n;i++){ if(x[i]!=y[i]) swap(s[x[i]],s[y[i]]); int ind = find(s,s+n,i)-s; p[r]=ind; q[r]=(i); swap(s[ind],s[i]); r++; continue; if(ind!=ber[r+1][i]) swap(s[ind],s[ber[r+1][i]]); p[r]=ind; q[r]=(ber[r+1][i]); r++; } // for(;r<m;r++){ // p[r]=0; // q[r]=0; // if(x[r]!=y[r]) // swap(s[x[r]],s[y[r]]); //} for(int i = 0;i<n;i++){ assert(s[i]==i); } return r; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 1 ms | 336 KB | Output is correct |
4 | Incorrect | 1 ms | 336 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 1 ms | 336 KB | Output is correct |
4 | Incorrect | 1 ms | 336 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Runtime error | 1 ms | 592 KB | Execution killed with signal 6 |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 1 ms | 336 KB | Output is correct |
4 | Incorrect | 1 ms | 336 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 85 ms | 77644 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 85 ms | 77644 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |