Submission #583767

#TimeUsernameProblemLanguageResultExecution timeMemory
583767joelauSplit the Attractions (IOI19_split)C++14
Compilation error
0 ms0 KiB
#include "split.h" #include <bits/stdc++.h> using namespace std; int N,M,A,B,C; vector<int> lst[100005], ans; queue<int> q; vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { N = n, M = p.size(), A = a, B = b, C = c; for (int i = 0; i < M; ++i) lst[p[i]].push_back(q[i]), lst[q[i]].push_back(p[i]); ans.assign(N,3); ans[0] = 2; q.push(0); int cnt = 1; while (!q.empty() && cnt < B) { int u = q.front(); q.pop(); for (int v: lst[u]) if (ans[v] == 3) { ans[v] = 2, cnt++; if (cnt >= B) break; } } for (int i = 0; i < N; ++i) if (ans[i] == 3) { ans[i] = 1; break; } return ans; }

Compilation message (stderr)

split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:14:4: error: 'class std::vector<int>' has no member named 'push'
   14 |  q.push(0);
      |    ^~~~
split.cpp:17:24: error: 'class std::vector<int>' has no member named 'pop'
   17 |   int u = q.front(); q.pop();
      |                        ^~~