# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1085457 | guagua0407 | Sorting (IOI15_sorting) | C++17 | 2 ms | 604 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 "sorting.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define f first
#define s second
#define all(x) x.begin(),x.end()
#define _ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n,m;
vector<int> p;
vector<int> x,y;
vector<pair<int,int>> vec;
bool check(int mid){
vector<int> pp=p;
for(int i=0;i<mid;i++){
swap(pp[x[i]],pp[y[i]]);
}
vector<bool> vis(n);
vec.clear();
for(int i=0;i<n;i++){
if(vis[i]) continue;
int cur=i;
while(!vis[cur]){
vis[cur]=true;
cur=pp[cur];
if(cur!=i){
vec.push_back({i,cur});
# | 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... |