# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
420243 | 2021-06-08T08:14:22 Z | Aldas25 | Sorting (IOI15_sorting) | C++14 | 2 ms | 332 KB |
#include "sorting.h" #include <bits/stdc++.h> using namespace std; #define FAST_IO ios_base::sync_with_stdio(0); cin.tie(nullptr) #define FOR(i, a, b) for (int i = (a); i <= (b); i++) #define REP(n) FOR(O, 1, (n)) #define f first #define s second #define pb push_back typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<pii> vii; typedef vector<ll> vl; const int MAXN = 200100; int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) { int cnt = 0; swap(S[X[cnt]], S[Y[cnt]]); for (int i = N-1; i >= 0; i--) { if (i < 2) { //if (Y[0] == 0) break; P[cnt] = 0, Q[cnt] = 0; if (S[1] != 1) Q[cnt] = 1; cnt++; break; } if (S[i] == i) continue; for (int j = 0; j < i; j++) { if (S[j] == i) { P[cnt] = j; Q[cnt] = i; swap(S[i], S[j]); break; } } cnt++; swap(S[X[cnt]], S[Y[cnt]]); } return cnt; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Integer 1 violates the range [0, 0] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Integer 1 violates the range [0, 0] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Integer 1 violates the range [0, 0] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |