# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
134282 | 2019-07-22T10:37:46 Z | Runtime_error_ | Sorting (IOI15_sorting) | C++14 | 4 ms | 376 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[]) { if(N < 2) return 0; int l =2, r =0,tr=0; while(S[l] == l && l<N) l++; for(int i=0;i<N;i++) if(S[i] != i) tr++; if(tr = 0) return 0; for(int i=0;i<M;i++){ swap( S[ X[i] ],S[ Y[i] ] ); // if(S[0] == 0 && S[1] == 1 && l == N) // return i; while(S[l] == l && l<N) l++; if( l == N){ // for(int i=0;i<N;i++) // cout<<S[i]<<" "; if(S[0] == 0 && S[1] == 1){ P[i] = 0,Q[i] = 0; i++; return i; } P[i]=0,Q[i] = 1; i++; return i; } int j; for(j=0;j<N;j++) if(S[j] == l) break; P[i] = l , Q[i] = j; swap(S[l],S[j]); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Incorrect | 2 ms | 256 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Incorrect | 2 ms | 256 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Incorrect | 2 ms | 256 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |