# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
421595 | 2021-06-09T09:48:22 Z | Pbezz | Sorting (IOI15_sorting) | C++14 | 3 ms | 332 KB |
#include "sorting.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back typedef pair<ll,ll> pii; const ll MAXN=2e5+5; const ll INF=1e9+7; int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) { int i,k,j,R=0; bool ok=true; for(i=0;i<N;i++){ if(S[i]!=i)ok=false; } if(ok)return 0; for(i=N-1;i>=0;i--){//find i, send it to ith position swap(S[0],S[1]); for(k=0;k<N;k++){ if(S[k]==i)break; } if(k!=i){ P[R]=k; Q[R]=i; R++; swap(S[k],S[i]); ok=true; for(j=0;j<N;j++){ if(S[j]!=j)ok=false; } if(ok){ return R; } } } return R; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Incorrect | 0 ms | 204 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Incorrect | 0 ms | 204 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Incorrect | 1 ms | 204 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Incorrect | 0 ms | 204 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |