Submission #881425

# Submission time Handle Problem Language Result Execution time Memory
881425 2023-12-01T08:43:44 Z 12345678 Carnival (CEOI14_carnival) C++17
0 / 100
263 ms 262144 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)
{
    printf("%d ", (int) v.size());
    for (auto x:v) printf("%d ", x);
    cout<<endl;
    scanf("%d", &res);
    return res;
}

void dfs(int u, int p)
{
    vs[u]=1;
    ans[u]=cnt;
    for (auto v:d[u]) if (v!=p) 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);
    printf("0 ");
    for (int i=1; i<=n; i++) printf("%d ", ans[i]);
    return 0;
}

Compilation message

carnival.cpp: In function 'int query(std::vector<int>)':
carnival.cpp:14:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |     scanf("%d", &res);
      |     ~~~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 248 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 236 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 44 ms 344 KB Integer 2 violates the range [1, 1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 238 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 263 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -