# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
252176 | Hehehe | Sorting (IOI15_sorting) | C++14 | 1 ms | 384 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h> //:3
using namespace std;
typedef long long ll;
#define all(a) (a).begin(), (a).end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define rc(s) return cout<<s,0
#define pi pair <int, int>
#define sz(x) (int)((x).size())
#include "sorting.h"
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const ll H = 2e5 + 11;
const ll mod = 1e9 + 9;
const ll INF64 = 3e18 + 1;
const double eps = 1e-14;
const double PI = acos(-1);
//ifstream in(".in");
//ofstream out(".out");
int pos[H];
int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
int n = N, m = M;
if(n == 1)return 0;
if(n == 2){
if(S[0] > S[1]){
P[0] = 0;
Q[0] = 1;
return 1;
}else return 0;
}
for(int i = 0; i < n; i++){
pos[S[i]] = i;
}
vector<pi>ans;
/* for(int i = 0; i < n; i++){
if(S[i] == i)continue;
ans.push_back({i, pos[i]});
int x = S[i], y = S[pos[i]];
swap(S[i], S[pos[i]]);
pos[y] = i;
pos[x] = x;
}
int k = 0;
for(auto it : ans){
P[k] = it.ff;
Q[k] = it.ss;
k++;
} */
return sz(ans);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |