Submission #881493

# Submission time Handle Problem Language Result Execution time Memory
881493 2023-12-01T09:58:29 Z 12345678 Carnival (CEOI14_carnival) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
 
using namespace std;
 
const int nx=155;
int n, res, cnt, vs[nx], ans[nx];
vector<int> d[nx];
 
int query(vector<int> v)
{
    cout<<v.size()<<' ';
    for (auto x:v) cout<<x<<' ';
    fflush(stdout);
    cin>>res;
    return res;
}
 
void dfs(int u, int p)
{
    vs[u]=1;
    ans[u]=cnt;
    for (auto v:d[u]) if (v!=p&&!vs[v]) dfs(v, u);
}
 
int main()
{
    cin>>n;
    for (int i=1; i<=n; i++) for (int j=i+1; j<=n; j++) if (query(vector<int> {i, j})==2) d[i].push_back(j), d[j].push_back(i);
    for (int i=1; i<=n; i++) if (!vs[i]) cnt++, dfs(i, i);
    cout<<0;
    for (int i=1; i<=n; i++) cout<<' '<<ans[i];
    fflush(stdout)
    return 0;
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:32:19: error: expected ';' before 'return'
   32 |     fflush(stdout)
      |                   ^
      |                   ;
   33 |     return 0;
      |     ~~~~~~