#include <bits/stdc++.h>
using namespace std;
#define in ({int x=0;int c=getchar(),n=0;for(;!isdigit(c);c=getchar()) n=(c=='-');for(;isdigit(c);c=getchar()) x=x*10+c-'0';n?-x:x;})
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int l,int r){return l+rng()%(r-l+1);}
#define fasty ios_base::sync_with_stdio(0),cin.tie(0);
#define forinc(a,b,c) for(int a=b,_c=c;a<=_c;++a)
#define fordec(a,b,c) for(int a=b,_c=c;a>=_c;--a)
#define forv(a,b) for(auto&a:b)
#define fi first
#define se second
#define pb push_back
#define ii pair<int,int>
#define mt make_tuple
#define all(a) a.begin(),a.end()
#define reset(f, x) memset(f, x, sizeof(f))
#define bit(x,i) ((x>>(i-1))&1)
#define on(x,i) (x|(1ll<<(i-1)))
#define off(x,i) (x&~(1<<(i-1)))
#define gg exit(0);
#include "library.h"
int n;
int mode;
int x[1111], y[1111], id[1111];
int root(int i){
return !id[i] ? i : id[i]=root(id[i]);
}
void join(int i,int j){
if((i=root(i))==(j=root(j))) return;
id[i]=j;
}
int tim(const vector<int>&q,int mode=1){
vector<int> fac(n), ask(n);
if(mode){
forv(i,q) fac[i-1]=1;
forinc(i,1,n) if(fac[root(i)-1]) ask[i-1]=1;
} else{
forv(i,q) ask[i-1]=1;
}
return Query(ask);
}
int dnc(vector<int> l,int i){
if(l.back()==i) l.pop_back();
if(l.size()<2) return l[0];
vector<int> r;
while(l.size()>r.size()){
r.push_back(l.back());
l.pop_back();
}
l.push_back(i);
return tim(l) < l.size() ? dnc(l,i) : dnc(r,i);
}
int pf,sf;
void dnc1(vector<int> l,int i,int has=2){
if(l.size()<2){
if(pf) sf=l[0]; else pf=l[0];
return;
}
vector<int> r;
while(l.size()>r.size()){
r.push_back(l.back());
l.pop_back();
}
l.push_back(i);
int to=tim(l);
if(l.size()==to+1){
l.pop_back();
dnc1(l,i,1);
if(has>1) dnc1(r,i,1);
} else if(l.size()==to){
dnc1(r,i,has);
} else{
l.pop_back();
dnc1(l,i,has);
}
}
vector<int> ad[1111];
void add(int i,int j){
ad[i].push_back(j);
ad[j].push_back(i);
}
void Solve(int N){
vector<int> a(N);
iota(all(a),1);
shuffle(all(a),rng);
Answer(a);
}
Compilation message
library.cpp: In function 'int dnc(std::vector<int>, int)':
library.cpp:57:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
return tim(l) < l.size() ? dnc(l,i) : dnc(r,i);
~~~~~~~^~~~~~~~~~
library.cpp: In function 'void dnc1(std::vector<int>, int, int)':
library.cpp:73:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if(l.size()==to+1){
~~~~~~~~^~~~~~
library.cpp:77:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
} else if(l.size()==to){
~~~~~~~~^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
384 KB |
Wrong Answer [8] |
2 |
Incorrect |
5 ms |
384 KB |
Wrong Answer [8] |
3 |
Incorrect |
5 ms |
384 KB |
Wrong Answer [8] |
4 |
Incorrect |
5 ms |
384 KB |
Wrong Answer [8] |
5 |
Incorrect |
5 ms |
384 KB |
Wrong Answer [8] |
6 |
Incorrect |
7 ms |
384 KB |
Wrong Answer [8] |
7 |
Incorrect |
4 ms |
384 KB |
Wrong Answer [8] |
8 |
Incorrect |
5 ms |
384 KB |
Wrong Answer [8] |
9 |
Incorrect |
4 ms |
384 KB |
Wrong Answer [8] |
10 |
Incorrect |
5 ms |
384 KB |
Wrong Answer [8] |
11 |
Correct |
5 ms |
384 KB |
# of queries: 0 |
12 |
Correct |
5 ms |
384 KB |
# of queries: 0 |
13 |
Correct |
4 ms |
384 KB |
# of queries: 0 |
14 |
Correct |
5 ms |
384 KB |
# of queries: 0 |
15 |
Incorrect |
5 ms |
384 KB |
Wrong Answer [8] |
16 |
Incorrect |
5 ms |
384 KB |
Wrong Answer [8] |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
384 KB |
Wrong Answer [8] |
2 |
Incorrect |
5 ms |
384 KB |
Wrong Answer [8] |
3 |
Incorrect |
5 ms |
384 KB |
Wrong Answer [8] |
4 |
Incorrect |
5 ms |
384 KB |
Wrong Answer [8] |
5 |
Incorrect |
5 ms |
384 KB |
Wrong Answer [8] |
6 |
Incorrect |
7 ms |
384 KB |
Wrong Answer [8] |
7 |
Incorrect |
4 ms |
384 KB |
Wrong Answer [8] |
8 |
Incorrect |
5 ms |
384 KB |
Wrong Answer [8] |
9 |
Incorrect |
4 ms |
384 KB |
Wrong Answer [8] |
10 |
Incorrect |
5 ms |
384 KB |
Wrong Answer [8] |
11 |
Correct |
5 ms |
384 KB |
# of queries: 0 |
12 |
Correct |
5 ms |
384 KB |
# of queries: 0 |
13 |
Correct |
4 ms |
384 KB |
# of queries: 0 |
14 |
Correct |
5 ms |
384 KB |
# of queries: 0 |
15 |
Incorrect |
5 ms |
384 KB |
Wrong Answer [8] |
16 |
Incorrect |
5 ms |
384 KB |
Wrong Answer [8] |
17 |
Incorrect |
5 ms |
384 KB |
Wrong Answer [8] |
18 |
Incorrect |
6 ms |
384 KB |
Wrong Answer [8] |
19 |
Incorrect |
5 ms |
384 KB |
Wrong Answer [8] |
20 |
Incorrect |
5 ms |
384 KB |
Wrong Answer [8] |
21 |
Incorrect |
5 ms |
384 KB |
Wrong Answer [8] |
22 |
Incorrect |
6 ms |
384 KB |
Wrong Answer [8] |
23 |
Incorrect |
5 ms |
384 KB |
Wrong Answer [8] |
24 |
Incorrect |
5 ms |
384 KB |
Wrong Answer [8] |
25 |
Incorrect |
5 ms |
384 KB |
Wrong Answer [8] |
26 |
Incorrect |
7 ms |
384 KB |
Wrong Answer [8] |
27 |
Incorrect |
5 ms |
384 KB |
Wrong Answer [8] |
28 |
Incorrect |
5 ms |
384 KB |
Wrong Answer [8] |
29 |
Incorrect |
5 ms |
304 KB |
Wrong Answer [8] |
30 |
Incorrect |
5 ms |
384 KB |
Wrong Answer [8] |