Submission #881415

#TimeUsernameProblemLanguageResultExecution timeMemory
88141512345678Carnival (CEOI14_carnival)C++17
0 / 100
1 ms596 KiB
#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 ", v.size()); for (auto x:v) printf("%d ", x); printf("\n"); 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.tie(NULL)->sync_with_stdio(false); 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 (stderr)

carnival.cpp: In function 'int query(std::vector<int>)':
carnival.cpp:11:14: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wformat=]
   11 |     printf("%d ", v.size());
      |             ~^    ~~~~~~~~
      |              |          |
      |              int        std::vector<int>::size_type {aka long unsigned int}
      |             %ld
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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...