#include"bits/stdc++.h"
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class x>
using ordered_set = tree<x, null_type,less<x>, rb_tree_tag,tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//---------------------------------------------------------------------------------------
#include <cstdio>
#include <vector>
#include "library.h"
using namespace std;
long long s=0;
vector <int> em;
void rec(long long cur,vector <int> grp)
{
long long fr=Query(grp);
grp[cur-1]=1;
if(fr==Query(grp))
{
long long sum=0;
grp[cur-1]=0;
for(int i=0;i<grp.size();i++)
{
if(grp[i]==1)
sum++;
}
if(sum==1)
{
for(int i=0;i<grp.size();i++)
{
if(grp[i]==1)
s=i+1;
}
return;
}
vector <int> on=em,tw=em;
long long took=0;
for(int i=0;took<sum/2;i++)
{
if(grp[i]==1)
{
took++;
on[i]=grp[i];
}
}
for(int i=0;i<grp.size();i++)
{
if((grp[i]^on[i])==1)
tw[i]=1;
}
rec(cur,on);
rec(cur,tw);
}
else
return;
}
void Solve(int N)
{
for(int i=1;i<=N;i++)
em.push_back(0);
for(int i=1;i<=N;i++)
{
vector <int> ask=em;
for(int j=1;j<=N;j++)
{
if(i==j)
continue;
ask[j-1]=1;
}
long long ans=Query(ask);
if(ans==1)
{
s=i;
break;
}
}
vector <int> ret,lef=em;
ret.push_back(s);
for(int i=1;i<=N;i++)
{
if(s==i)
continue;
lef[i-1]=1;
}
for(int i=1;i<N;i++)
{
rec(s,lef);
ret.push_back(s);
}
Answer(ret);
}
Compilation message
library.cpp: In function 'void rec(long long int, std::vector<int>)':
library.cpp:27:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
27 | for(int i=0;i<grp.size();i++)
| ~^~~~~~~~~~~
library.cpp:34:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
34 | for(int i=0;i<grp.size();i++)
| ~^~~~~~~~~~~
library.cpp:52:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
52 | for(int i=0;i<grp.size();i++)
| ~^~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
16 ms |
208 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
16 ms |
208 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |