# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1053712 | 2024-08-11T16:06:28 Z | XJP12 | Sorting (IOI15_sorting) | C++14 | 1 ms | 440 KB |
#include <bits/stdc++.h> #include "sorting.h" using namespace std; typedef vector<int> vi; int findSwapPairs(int n, int s[], int m, int x[], int y[], int p[], int q[]) { int r=0; bool ban=true; for(int i=0; i<n; i++){ if(s[i]!=i){ ban=false; break; } } if (ban) return 0; if(y[0]==1){ for(int i=0; i<n; i++){ swap(s[1], s[0]); r++; /*for(int j=0; j<n; j++){ cout<<s[j]<<" "; }*/ // cout<<endl; ban=true; for(int j=0; j<n; j++){ if(s[j]!=j){ ban=false; break; } } if (ban) break; for(int j=0; j<n; j++){ if(s[j]==i){ if(s[i]==0 && i==1){ p[i]=j; q[i]=i-1; swap(s[i-1], s[j]); }else{ p[i]=j; q[i]=i; swap(s[i], s[j]); } break; } } /* for(int j=0; j<n; j++){ cout<<s[j]<<" "; } cout<<endl<<endl;*/ } if(s[1]!=1 && s[0]!=0){ p[r]=0; q[r]=1; r++; } /*for(int i=0; i<r; i++){ cout<<p[i]<<" "<<q[i]<<endl; }*/ }else{ for(int i=0; i<n; i++){ for(int j=0; j<n; j++){ if(s[j]==i && j!=i){ r++; p[i]=j; q[i]=i; swap(s[i], s[j]); break; } } /* for(int j=0; j<n; j++){ cout<<s[j]<<" "; } cout<<endl;*/ } /* for(int i=0; i<r; i++){ cout<<p[i]<<" "<<q[i]<<endl; }*/ } return r; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Incorrect | 0 ms | 348 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Incorrect | 0 ms | 348 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 440 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Incorrect | 0 ms | 348 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Incorrect | 0 ms | 348 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |