# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
490933 |
2021-11-29T22:16:16 Z |
ETK |
Library (JOI18_library) |
C++14 |
|
37 ms |
288 KB |
//GOODTEK!!!
#include "library.h"
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
#define pii pair<int,int>
#define vi vector<int>
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define ll long long
using namespace std;
inline ll read(){
ll x=0,f=1;char ch=getchar();
while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}
while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
return x*f;
}
int n;
int ask(vi vec,int w=0){
vi que(n);
for(int x:vec)que[x-1]=1;
if(w)que[w-1]=1;
return Query(que);
}
void Solve(int N){
n=N;
vi p(n);
for(int i=0;i<n;i++)p[i]=i+1;
rep(i,1,n-1){
if(i==n-1||ask(vi(p.begin()+1,p.end())))break;
swap(p[0],p[i+1]);
}
rep(i,0,n-2){
auto l=p.begin()+i+1,r=p.end();
while(l+1!=r){
auto mid=l+(r-l)/2;
if(ask(vi(l,mid))==ask(vi(l,mid),p[i]))r=mid;
else l=mid;
}
swap(p[i+1],*l);
}
Answer(p);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
37 ms |
288 KB |
Wrong Answer [8] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
37 ms |
288 KB |
Wrong Answer [8] |
2 |
Halted |
0 ms |
0 KB |
- |