Submission #1077844

#TimeUsernameProblemLanguageResultExecution timeMemory
1077844BoasSplit the Attractions (IOI19_split)C++17
Compilation error
0 ms0 KiB
#include "split.h" #include <bits/stdc++.h> using namespace std; #define sz(x) (int)x.size() #define pb push_back #define loop(x, i) for (int i = 0; i < x; i++) #define rev(x, i) for (int i = (int)x - 1; i >= 0; i--) #define ALL(x) begin(x), end(x) typedef signed i32; typedef vector<i32> vi32; typedef vector<int> vi; typedef vector<bool> vb; typedef vector<vi> vvi; typedef vector<vb> vvb; vi find_split(int n, int a, int b, int c, vi p, vi q) { map<int, int> partix; partix[a] = 1; partix[b] = 2; partix[c] = 3; array<int, 3> tmp = {a, b, c}; sort(ALL(tmp)); auto [a, b, c] = tmp; vvi adj(n); int m = sz(p); loop(m, i) { adj[p[i]].pb(q[i]); adj[q[i]].pb(p[i]); } vi res(n); auto dfs = [&](auto &&self, int i, int prev, int cnt) -> void { if (cnt < a) res[i] = partix[a]; else if (cnt < a + b) res[i] = partix[b]; else res[i] = partix[c]; for (int j : adj[i]) { if (j == prev) continue; self(self, j, i, cnt + 1); } }; loop(n, i) { if (adj[i].size() == 1) { dfs(dfs, i, i, 0); break; } } // assert(*min_element(ALL(res)) == 1); assert(*max_element(ALL(res)) != 0); return res; }

Compilation message (stderr)

split.cpp: In function 'vi find_split(int, int, int, int, vi, vi)':
split.cpp:25:8: error: declaration of 'auto a' shadows a parameter
   25 |  auto [a, b, c] = tmp;
      |        ^
split.cpp:17:26: note: 'int a' previously declared here
   17 | vi find_split(int n, int a, int b, int c, vi p, vi q)
      |                      ~~~~^
split.cpp:25:11: error: declaration of 'auto b' shadows a parameter
   25 |  auto [a, b, c] = tmp;
      |           ^
split.cpp:17:33: note: 'int b' previously declared here
   17 | vi find_split(int n, int a, int b, int c, vi p, vi q)
      |                             ~~~~^
split.cpp:25:14: error: declaration of 'auto c' shadows a parameter
   25 |  auto [a, b, c] = tmp;
      |              ^
split.cpp:17:40: note: 'int c' previously declared here
   17 | vi find_split(int n, int a, int b, int c, vi p, vi q)
      |                                    ~~~~^