# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
973943 | 2024-05-02T13:16:16 Z | PagodePaiva | Sorting (IOI15_sorting) | C++17 | 3 ms | 348 KB |
#include<bits/stdc++.h> #include "sorting.h" using namespace std; int findSwapPairs(int n, int s[], int m, int x[], int y[], int p[], int q[]) { for(int i = 0;i < m;i++) p[i] = q[i] = 0; vector <int> v; for(int i = 0;i < n;i++){ v.push_back(i); } for(int i = n-1;i >= 0;i--){ swap(v[x[i]], v[y[i]]); } for(int i = 0;i < n;i++){ // for(int j = 0;j < n;j++) { // cout << v[j] << ' '; // } // cout << '\n'; swap(v[x[i]], v[y[i]]); swap(s[x[i]], s[y[i]]); int poss, posv; for(int j = 0;j < n;j++){ if(s[j] == i) poss = j; if(v[j] == i) posv = j; } p[i] = poss; q[i] = posv; swap(s[poss], s[posv]); } // for(int j = 0;j < n;j++) cout << v[j] << ' '; // cout << "\n"; // for(int j = 0;j < n;j++) cout << s[j] << ' '; return n; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Incorrect | 0 ms | 348 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Incorrect | 0 ms | 348 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 1 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 | 1 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Incorrect | 0 ms | 348 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |