#include "library.h"
#include <bits/stdc++.h>
#define f first
#define s second
#define vec vector
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pw(x) (1LL<<(x))
#define sz(x) (int)(x).size()
#define m_p make_pair
#define fast_prep ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef long double ld;
template<class T> bool umin(T &a,const T &b){return (a>b?a=b,1:0);}
template<class T> bool umax(T &a,const T &b){return (a<b?a=b,1:0);}
void Solve(int n){
vec<int> ans;
for(int i=0;i<n;i++){
vec<int> h(n,1);
h[i]=0;
if(Query(h)==1)
ans.pb(i);
}
int last=ans.back();
ans.pop_back();
for(int i=1;i<n-1;i++){
vec<int> here;
vec<int>u(n);
for(auto &j : ans)
u[j]=1;
for(int j=0;j<n;j++){
if(!u[j])
here.pb(j);
}
while(sz(here)!=1){
vec<int> lft,rgt;
vec<int> ask(n,0);
for(int j=0;j<sz(here)/2;j++) ask[here[j]]=1,lft.pb(here[j]);
for(int j=sz(lft);j<sz(here);j++) rgt.pb(here[j]);
int fi=Query(ask);
ask[ans.back()]=1;
int si=Query(ask);
if(fi==si) here=lft;
else here=rgt;
}
ans.pb(here[0]);
}
ans.pb(last);
for(auto &z : ans) ++z;
// for(auto &z : ans)
// cout<<z<<' ';
// cout<<endl;
Answer(ans);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
32 ms |
208 KB |
# of queries: 2550 |
2 |
Correct |
36 ms |
304 KB |
# of queries: 2531 |
3 |
Correct |
39 ms |
208 KB |
# of queries: 2706 |
4 |
Correct |
38 ms |
300 KB |
# of queries: 2704 |
5 |
Correct |
45 ms |
208 KB |
# of queries: 2702 |
6 |
Correct |
30 ms |
208 KB |
# of queries: 2698 |
7 |
Correct |
37 ms |
296 KB |
# of queries: 2682 |
8 |
Correct |
35 ms |
304 KB |
# of queries: 2585 |
9 |
Correct |
35 ms |
208 KB |
# of queries: 2693 |
10 |
Correct |
20 ms |
208 KB |
# of queries: 1569 |
11 |
Runtime error |
1 ms |
336 KB |
Execution killed with signal 11 |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
32 ms |
208 KB |
# of queries: 2550 |
2 |
Correct |
36 ms |
304 KB |
# of queries: 2531 |
3 |
Correct |
39 ms |
208 KB |
# of queries: 2706 |
4 |
Correct |
38 ms |
300 KB |
# of queries: 2704 |
5 |
Correct |
45 ms |
208 KB |
# of queries: 2702 |
6 |
Correct |
30 ms |
208 KB |
# of queries: 2698 |
7 |
Correct |
37 ms |
296 KB |
# of queries: 2682 |
8 |
Correct |
35 ms |
304 KB |
# of queries: 2585 |
9 |
Correct |
35 ms |
208 KB |
# of queries: 2693 |
10 |
Correct |
20 ms |
208 KB |
# of queries: 1569 |
11 |
Runtime error |
1 ms |
336 KB |
Execution killed with signal 11 |
12 |
Halted |
0 ms |
0 KB |
- |