Submission #419061

#TimeUsernameProblemLanguageResultExecution timeMemory
419061EncryptingWolfSplit the Attractions (IOI19_split)C++14
Compilation error
0 ms0 KiB
#include <vector> #include <iostream> #include <set> #include <map> using namespace std; typedef long long ll; #define FOR(i,x,y) for (ll i = x; i <y; i++) vector<vector<int>> adj; vector<int> ret; int counts = 0; int B; int nexts; void dfs(int x, int val, int S) { if (counts >= S) { nexts = x; return; } if (ret[x] != 3) return; ret[x] = val; counts++; for (auto i : adj[x]) dfs(i, val); } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { B = b; adj.resize(n); ret.resize(n, 3); FOR(i, 0, p.size()) { adj[p[i]].push_back(q[i]); adj[q[i]].push_back(p[i]); } int end = 0; FOR(i, 0, n) { if (adj[i].size() == 1) { end = i; break; } } dfs(end, 1,a); dfs(nexts, 2, b); return ret; }

Compilation message (stderr)

split.cpp: In function 'void dfs(int, int, int)':
split.cpp:28:13: error: too few arguments to function 'void dfs(int, int, int)'
   28 |   dfs(i, val);
      |             ^
split.cpp:15:6: note: declared here
   15 | void dfs(int x, int val, int S)
      |      ^~~
split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:7:37: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 | #define FOR(i,x,y) for (ll i = x; i <y; i++)
......
   36 |  FOR(i, 0, p.size())
      |      ~~~~~~~~~~~~~~                  
split.cpp:36:2: note: in expansion of macro 'FOR'
   36 |  FOR(i, 0, p.size())
      |  ^~~