# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
874584 | HuyQuang_re_Zero | 정렬하기 (IOI15_sorting) | C++14 | 148 ms | 39732 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>
#define ll long long
#define db long double
#define II pair <ll,ll>
#define III pair <ll,II>
#define IV pair <vector <int>,vector <int> >
#define TII pair <treap*,treap*>
#define fst first
#define snd second
#define BIT(x,i) ((x>>i)&1)
#define pi acos(-1)
#define to_radian(x) (x*pi/180.0)
#define to_degree(x) (x*180.0/pi)
#define Log(x) (31-__builtin_clz((int)x))
#define LogLL(x) (63-__builtin_clzll((ll)x))
#include "sorting.h"
#define mxn 600005
using namespace std;
int n,i,tg[mxn],p[mxn],pos[mxn],r[mxn],x[mxn],y[mxn],m,visited[mxn],res,a[mxn],b[mxn];
int root(int u) { return (u==r[u]) ? u : r[u]=root(r[u]); }
bool check(int k)
{
for(i=1;i<=n;i++) tg[i]=p[i],r[i]=i;
int comp=n;
for(i=1;i<=k;i++) swap(p[x[i]],p[y[i]]);
for(i=1;i<=n;i++)
if(root(i)!=root(p[i]))
{
r[root(i)]=root(p[i]);
comp--;
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... |