#include <bits/stdc++.h>
#define forn(i,n) for(int i =0;i<int(n);i++)
#define nfor(i,n) for(int i =int(n)-1;i>=0;i--)
#define rep(i,j,n) for(int i = int(j);i <= int(n);i++)
#define rev(i,j,n) for(int i = int(j);i>=int(n);i--)
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define oo 2000000000
#define ooo 2000000000000000000
#define all(x) x.begin(),x.end()
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<pii> vii;
const int N = 100010,MOD = 1000000007;
const double PI = acos(-1.0);
int gcd(int a,int b){return (b==0) ? a : gcd(b,a%b);}
string tostr(ll num){string res = "";while (num)res += char('0' + (num % 10)),num/=10;reverse(all(res));return res;}
string tobin(int num){string res="";while(num)res += char('0' + (num % 2)),num/=2;reverse(all(res));return res;}
ll tonum(string te){ll res = 0;forn(i,te.size())res *= 10LL,res += te[i]-'0';return res;}
int bit(vector <ll> &v,ll a,ll b){return upper_bound(all(v),b)-upper_bound(all(v),a-1);}
void fl(){fflush(stdout);}
int n,ans[155],cnt = 0,out;
vector <int> party;
void print(){
cout<<endl;
printf("%d",(int)party.size());
for(int i =0;i < (int)party.size();i++)
printf(" %d",party[i]);
cout<<endl;
}
int main(){
scanf("%d",&n);
memset(ans,-1,sizeof ans);
for (int i = 1;i<=n;i++){
if (ans[i] != -1)
continue;
ans[i] = ++cnt;
party.clear();
party.push_back(i);
for (int j = i + 1;j<=n;j++){
party.push_back(j);
print();
scanf("%d",&out);
if (out != 1)
party.pop_back();
else
ans[j] = ans[i];
}
}
printf("0");
for (int i= 1;i<=n;i++)
printf(" %d",ans[i]);
return 0;
}
Compilation message
carnival.cpp: In function 'int main()':
carnival.cpp:39:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&n);
^
carnival.cpp:50:29: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&out);
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
2020 KB |
Output is correct |
2 |
Partially correct |
19 ms |
2020 KB |
Partially correct |
3 |
Partially correct |
36 ms |
2020 KB |
Partially correct |
4 |
Partially correct |
49 ms |
2020 KB |
Partially correct |
5 |
Correct |
9 ms |
2020 KB |
Output is correct |
6 |
Correct |
3 ms |
2020 KB |
Output is correct |
7 |
Correct |
6 ms |
2020 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
2020 KB |
Output is correct |
2 |
Correct |
19 ms |
2020 KB |
Output is correct |
3 |
Partially correct |
39 ms |
2020 KB |
Partially correct |
4 |
Partially correct |
33 ms |
2020 KB |
Partially correct |
5 |
Correct |
0 ms |
2020 KB |
Output is correct |
6 |
Correct |
16 ms |
2020 KB |
Output is correct |
7 |
Correct |
9 ms |
2020 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
2020 KB |
Output is correct |
2 |
Correct |
13 ms |
2020 KB |
Output is correct |
3 |
Partially correct |
39 ms |
2020 KB |
Partially correct |
4 |
Partially correct |
56 ms |
2020 KB |
Partially correct |
5 |
Correct |
9 ms |
2020 KB |
Output is correct |
6 |
Correct |
13 ms |
2020 KB |
Output is correct |
7 |
Partially correct |
29 ms |
2020 KB |
Partially correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
2020 KB |
Output is correct |
2 |
Correct |
6 ms |
2020 KB |
Output is correct |
3 |
Partially correct |
19 ms |
2020 KB |
Partially correct |
4 |
Partially correct |
66 ms |
2020 KB |
Partially correct |
5 |
Partially correct |
16 ms |
2020 KB |
Partially correct |
6 |
Partially correct |
23 ms |
2020 KB |
Partially correct |
7 |
Partially correct |
16 ms |
2020 KB |
Partially correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
2020 KB |
Output is correct |
2 |
Correct |
13 ms |
2020 KB |
Output is correct |
3 |
Partially correct |
23 ms |
2020 KB |
Partially correct |
4 |
Partially correct |
46 ms |
2020 KB |
Partially correct |
5 |
Partially correct |
23 ms |
2020 KB |
Partially correct |
6 |
Partially correct |
26 ms |
2020 KB |
Partially correct |
7 |
Partially correct |
93 ms |
2020 KB |
Partially correct |