# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
833921 | 2023-08-22T09:30:32 Z | Ellinor | Sorting (IOI15_sorting) | C++14 | 1 ms | 340 KB |
//#include<bits/stdc++.h> #include <iostream> #include <vector> #include <queue> #include <string> #include <cmath> #include <cstdlib> #include <set> #include <iomanip> #include <limits> #include <map> #include <assert.h> #include <algorithm> #include <list> #include <iterator> #include <fstream> #include <random> #include <unordered_map> #include <array> using namespace std; #define rep(i,a,b) for (int i = (a); i < b; i++) #define pb push_back #define all(x) x.begin(), x.end() typedef long long ll; //typedef pair<int, int> pii; // fast vector<int> S; vector<int> at; #include "sorting.h" // !! void swap(int a, int b) { int tmp = S[a]; S[a] = S[b]; S[b] = tmp; at[S[a]] = a; at[S[b]] = b; } int findSwapPairs(int N, int ss[], int M, int X[], int Y[], int P[], int Q[]) { // P[0] = 0; // Q[0] = 0; S.assign(N, 0); rep(i,0,N) { S[i] = ss[i]; } at.assign(N, 0); rep(i,0,N) { at[S[i]] = i; } int R = 0; rep(i,2,N) { if (S[i] != i) { swap(X[R], Y[R]); R++; swap(at[i], i); } } // if (Y[0] == 0) // { // if (S[0] != 0) R++; // } // else // { // if (R % 2 == 0) if (S[0] != 0) R++; // else if (S[1] != 0) R++; // // // } if (S[0] != 0) R++; return R; } // 20p, 0, 0 // 16p, 0, 1, first all else, then 1 -> 1 (if needed)
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 216 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Incorrect | 0 ms | 212 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 216 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Incorrect | 0 ms | 212 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Incorrect | 0 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 216 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Incorrect | 0 ms | 212 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |