Submission #419050

#TimeUsernameProblemLanguageResultExecution timeMemory
419050EncryptingWolfSplit 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; void dfs(int x) { if (ret[x] == 2) return; ret[x] == 2; for (auto i : adj[x]) dfs(i); } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { ret.resize(n, 3); FOR(i, 0, p.size()) { adj[p[i]].push_back[q[i]]; adj[q[i]].push_back[p[i]]; } dfs(0); FOR(i, 0, n) { if (ret[i] != 2) { ret[i] = 1; return ret; } } return ret; }

Compilation message (stderr)

split.cpp: In function 'void dfs(int)':
split.cpp:16:9: warning: value computed is not used [-Wunused-value]
   16 |  ret[x] == 2;
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++)
......
   24 |  FOR(i, 0, p.size())
      |      ~~~~~~~~~~~~~~                  
split.cpp:24:2: note: in expansion of macro 'FOR'
   24 |  FOR(i, 0, p.size())
      |  ^~~
split.cpp:26:22: error: invalid types '<unresolved overloaded function type>[__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}]' for array subscript
   26 |   adj[p[i]].push_back[q[i]];
      |                      ^
split.cpp:27:22: error: invalid types '<unresolved overloaded function type>[__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}]' for array subscript
   27 |   adj[q[i]].push_back[p[i]];
      |                      ^