#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
#define pb push_back
#define sz(vec) ((ll)vec.size())
#define all(vec) vec.begin(), vec.end()
#define f first
#define s second
const int MOD = 1e9 + 7;
const ll BIGINF = ((ll)1e18) + 7;
#define Speeed ios::sync_with_stdio(0);cin.tie(NULL); cout.tie(NULL);
int main(){
ll n, col = 1;
cin>>n;
vector<ll> ans(n+1);
set<ll> sett;
for(ll i = (1<<n) - 1; i >= 0; i--){
vector<ll> temp;
for(ll j = 0; j < n; j++){
if(i&(1<<j)){
temp.pb(j+1);
}
}
if(sz(temp)){
cout<<sz(temp)<<" ";
for(auto x: temp)cout<<x<<" ";
cout<<endl;
ll x;
cin>>x;
if(x==1){
bool cont = true;
for(auto x: temp){
if(sett.find(x)!=sett.end())cont = false;
}
if(cont){
// cout<<"NAH\n";
for(auto x: temp){
sett.insert(x);
ans[x] = col;
}
col++;
}
// cout<<"all same\n";
}
}
// 1 2 1 3 2
if(sz(sett)==n)break;
}
cout<<"0 ";
for(ll i = 1; i <= n; i++)cout<<ans[i]<<" ";
cout<<endl;
return 0;
// 1 3 1
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
208 KB |
Integer 0 violates the range [1, 11] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
145 ms |
288 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
Integer 0 violates the range [1, 1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
148 ms |
284 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
134 ms |
284 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |