Submission #290554

#TimeUsernameProblemLanguageResultExecution timeMemory
290554jairRSSplit the Attractions (IOI19_split)C++17
Compilation error
0 ms0 KiB
#include "split.h" typedef vector<int> vi; typedef vector<vi> vvi; using namespace std; vvi adj; vi degree; int ga, gb, gc; void dfs(int src, int prev = -1) { if (gc > 0) { degree[src] = 3; gc--; } else if (gb > 0) { degree[src] = 2; gb--; } else if (ga > 0) { degree[src] = 1; ga--; } for (int a : adj[src]) if (a != prev) dfs(a, src); } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { ga = a; gb = b; gc = c; degree = vi(n, 0); adj = vvi(n); for (int i = 0; i < n; i++) { adj[p[i]].push_back(q[i]); adj[q[i]].push_back(p[i]); degree[p[i]]++; degree[q[i]]++; } for (int i = 0; i < n; i++) { if (degree[i] == 1) { dfs(i); break; } } return degree; }

Compilation message (stderr)

split.cpp:2:9: error: 'vector' does not name a type
    2 | typedef vector<int> vi;
      |         ^~~~~~
split.cpp:3:9: error: 'vector' does not name a type
    3 | typedef vector<vi> vvi;
      |         ^~~~~~
split.cpp:6:1: error: 'vvi' does not name a type
    6 | vvi adj;
      | ^~~
split.cpp:7:1: error: 'vi' does not name a type; did you mean 'void'?
    7 | vi degree;
      | ^~
      | void
split.cpp: In function 'void dfs(int, int)':
split.cpp:14:3: error: 'degree' was not declared in this scope
   14 |   degree[src] = 3;
      |   ^~~~~~
split.cpp:19:3: error: 'degree' was not declared in this scope
   19 |   degree[src] = 2;
      |   ^~~~~~
split.cpp:24:3: error: 'degree' was not declared in this scope
   24 |   degree[src] = 1;
      |   ^~~~~~
split.cpp:28:15: error: 'adj' was not declared in this scope
   28 |  for (int a : adj[src])
      |               ^~~
split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:38:2: error: 'degree' was not declared in this scope
   38 |  degree = vi(n, 0);
      |  ^~~~~~
split.cpp:38:11: error: 'vi' was not declared in this scope
   38 |  degree = vi(n, 0);
      |           ^~
split.cpp:39:2: error: 'adj' was not declared in this scope
   39 |  adj = vvi(n);
      |  ^~~
split.cpp:39:8: error: 'vvi' was not declared in this scope
   39 |  adj = vvi(n);
      |        ^~~