Submission #838791

#TimeUsernameProblemLanguageResultExecution timeMemory
838791ErJKeys (IOI21_keys)C++17
Compilation error
0 ms0 KiB
#include <vector> #include <unordered_map> #include <cmath> #include <algorithm> #include <iostream> #include <queue> using namespace std; typedef long long ll; vector<vector<pair<int, int>>> edges; //kam, key vector<int> p, r; vector<vector<int>> kv;//potrebuji klic na hranu vedouci do vrcholu vector<bool> was; int DFS(int u) { int ans = 0; queue<int> q; q.push(u); was[u] = true; kv[r[u]][0] = -2; while (!q.empty()) { int v = q.front(); q.pop(); for (int i = 0; i < edges[v].size(); i++) { //cout << i << endl; int w = edges[v][i].first; int kw = edges[v][i].second; if (kv[kw][0] == -2) { if (!was[w]) { was[w] = true; q.push(w); ans++; if (kv[r[w]][0] != -2) { kv[r[w]][0] = -2; for (int i = 1; i < kv[r[w]].size(); i++) { int x = kv[r[w]][i]; if (!was[x]) { was[x] = true; q.push(x); ans++; } } } } } else { if(!was[w]) kv[kw].push_back(w); } } } return ans; }

Compilation message (stderr)

keys.cpp: In function 'int DFS(int)':
keys.cpp:26:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |         for (int i = 0; i < edges[v].size(); i++) {
      |                         ~~^~~~~~~~~~~~~~~~~
keys.cpp:37:43: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |                         for (int i = 1; i < kv[r[w]].size(); i++) {
      |                                         ~~^~~~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/cch6rZvV.o: in function `main':
grader.cpp:(.text.startup+0x30a): undefined reference to `find_reachable(std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status