#pragma GCC optimize("O3")
#include "library.h"
#include<bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<62);
const int inf=(1<<30);
const int nmax=1e5+50;
const int mod=1e9+7;
using namespace std;
int n,viz[1050];
int get(int rt)
{
vector<int>v;
for(int i=1;i<=n;i++)if(!viz[i])v.pb(i);
while((int)v.size()!=1)
{
vector<int>l,r,s(n+2,0);
int mid=(int)v.size()/2;
for(int i=0;i<mid;i++)l.pb(v[i]),s[v[i]-1]=1;
for(int i=mid;i<v.size();i++)r.pb(v[i]);
int x=Query(s);
s[rt-1]=1;
if(Query(s)==x)v=l;
else v=r;
}
return v[0];
}
void Solve(int N)
{
n=N;
int r;
for(int i=1;i<=n;i++)
{
vector<int>v;
for(int j=1;j<=n;j++)
{
if(i==j)v.pb(0);
else v.pb(1);
}
if(Query(v)==1)r=i;
}
vector<int>ans;
ans.pb(r);
viz[r]=1;
for(int i=2;i<=n;i++)
{
int nxt=get(r);
ans.pb(nxt);
r=nxt;
viz[r]=1;
}
Answer(ans);
}
/*int main()
{
//freopen("sol.in","r",stdin);
//freopen("sol.out","w",stdout);
ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
return 0;
}*/
Compilation message
library.cpp: In function 'int get(int)':
library.cpp:29:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=mid;i<v.size();i++)r.pb(v[i]);
~^~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6 ms |
376 KB |
Wrong Answer [1] |
2 |
Incorrect |
5 ms |
252 KB |
Wrong Answer [1] |
3 |
Incorrect |
4 ms |
248 KB |
Wrong Answer [1] |
4 |
Incorrect |
6 ms |
376 KB |
Wrong Answer [1] |
5 |
Incorrect |
6 ms |
376 KB |
Wrong Answer [1] |
6 |
Incorrect |
6 ms |
376 KB |
Wrong Answer [1] |
7 |
Incorrect |
5 ms |
248 KB |
Wrong Answer [1] |
8 |
Incorrect |
5 ms |
248 KB |
Wrong Answer [1] |
9 |
Incorrect |
6 ms |
248 KB |
Wrong Answer [1] |
10 |
Incorrect |
4 ms |
380 KB |
Wrong Answer [1] |
11 |
Runtime error |
2 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
12 |
Correct |
2 ms |
376 KB |
# of queries: 2 |
13 |
Incorrect |
2 ms |
376 KB |
Wrong Answer [1] |
14 |
Incorrect |
2 ms |
376 KB |
Wrong Answer [1] |
15 |
Incorrect |
2 ms |
248 KB |
Wrong Answer [1] |
16 |
Incorrect |
2 ms |
376 KB |
Wrong Answer [1] |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6 ms |
376 KB |
Wrong Answer [1] |
2 |
Incorrect |
5 ms |
252 KB |
Wrong Answer [1] |
3 |
Incorrect |
4 ms |
248 KB |
Wrong Answer [1] |
4 |
Incorrect |
6 ms |
376 KB |
Wrong Answer [1] |
5 |
Incorrect |
6 ms |
376 KB |
Wrong Answer [1] |
6 |
Incorrect |
6 ms |
376 KB |
Wrong Answer [1] |
7 |
Incorrect |
5 ms |
248 KB |
Wrong Answer [1] |
8 |
Incorrect |
5 ms |
248 KB |
Wrong Answer [1] |
9 |
Incorrect |
6 ms |
248 KB |
Wrong Answer [1] |
10 |
Incorrect |
4 ms |
380 KB |
Wrong Answer [1] |
11 |
Runtime error |
2 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
12 |
Correct |
2 ms |
376 KB |
# of queries: 2 |
13 |
Incorrect |
2 ms |
376 KB |
Wrong Answer [1] |
14 |
Incorrect |
2 ms |
376 KB |
Wrong Answer [1] |
15 |
Incorrect |
2 ms |
248 KB |
Wrong Answer [1] |
16 |
Incorrect |
2 ms |
376 KB |
Wrong Answer [1] |
17 |
Incorrect |
35 ms |
248 KB |
Wrong Answer [1] |
18 |
Incorrect |
32 ms |
376 KB |
Wrong Answer [1] |
19 |
Incorrect |
34 ms |
248 KB |
Wrong Answer [1] |
20 |
Incorrect |
26 ms |
328 KB |
Wrong Answer [1] |
21 |
Incorrect |
34 ms |
376 KB |
Wrong Answer [1] |
22 |
Incorrect |
34 ms |
408 KB |
Wrong Answer [1] |
23 |
Incorrect |
49 ms |
376 KB |
Wrong Answer [1] |
24 |
Incorrect |
13 ms |
376 KB |
Wrong Answer [1] |
25 |
Incorrect |
31 ms |
248 KB |
Wrong Answer [1] |
26 |
Incorrect |
29 ms |
376 KB |
Wrong Answer [1] |
27 |
Incorrect |
9 ms |
324 KB |
Wrong Answer [1] |
28 |
Incorrect |
30 ms |
248 KB |
Wrong Answer [1] |
29 |
Incorrect |
32 ms |
248 KB |
Wrong Answer [1] |
30 |
Incorrect |
21 ms |
376 KB |
Wrong Answer [1] |