Submission #36407

# Submission time Handle Problem Language Result Execution time Memory
36407 2017-12-08T17:13:11 Z bnahmad15 Carnival (CEOI14_carnival) C++14
0 / 100
0 ms 2016 KB
#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(){
    fl();
    printf("%d",(int)party.size());
    for(int i =0;i < (int)party.size();i++)
        printf(" %d",party[i]);
    fl();
}
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);
                             ^
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 2016 KB Execution timed out (wall clock limit exceeded)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 2016 KB Execution timed out (wall clock limit exceeded)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 2016 KB Execution timed out (wall clock limit exceeded)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 2016 KB Execution timed out (wall clock limit exceeded)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 2016 KB Execution timed out (wall clock limit exceeded)
2 Halted 0 ms 0 KB -