제출 #476360

#제출 시각아이디문제언어결과실행 시간메모리
476360Lam_lai_cuoc_doiSplit the Attractions (IOI19_split)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using ull = unsigned long long; template <class T> void read(T &x) { x = 0; register int c; while ((c = getchar()) && (c > '9' || c < '0')) ; for (; c >= '0' && c <= '9'; c = getchar()) x = x * 10 + c - '0'; } constexpr bool typetest = 1; constexpr int N = 2e5 + 5; constexpr int Inf = 1e9 + 7; vector<pair<int, int>> adj[N]; bool inused[N]; int cnt[N]; pair<int, int> a[3]; void dfs(int v, int p = 0) { cnt[v] = 1; for (auto i : adj[v]) if (i.first != p) { dfs(i.first, v); cnt[v] += cnt[i.first]; } } vector<int> find_split(int n, int A, int B, int C, vector<int> p, vector<int> q) { int m = p.size(); vector<int> ans(n, 0); if (m == n - 1) { a[0] = make_pair(A, 1); a[1] = make_pair(B, 2); a[2] = make_pair(C, 3); sort(a, a + 3); for (int i = 0; i < m; ++i) { inused[i] = 1; adj[p[i]].emplace_back(q[i], i); adj[q[i]].emplace_back(p[i], i); } dfs(0); int cnt1(0); function<void(int, int, pair<int, int>)> Colored = [&](int v, int p, pair<int, int> a) { ++cnt1; ans[v] = a.second; if (cnt1 == a.first) return; for (auto i : adj[v]) if (inused[i.second] && i.first != p) { Colored(i.first, v, a); if (cnt1 == a.first) return; } }; for (int i = 0; i < n; ++i) for (auto j : adj[i]) if (cnt[j.first] < cnt[i]) { if (cnt[j.first] >= a[0].first && (n - cnt[j.first]) >= a[1].first) { inused[j.second] = 0; cnt1 = 0; Colored(j.first, -1, a[0]); cnt1 = 0; Colored(i, -1, a[1]); } else if (cnt[j.first] >= a[1].first && (n - cnt[j.first]) >= a[0].first) { inused[j.second] = 0; cnt1 = 0; Colored(j.first, -1, a[1]); cnt1 = 0; Colored(i, -1, a[0]); } } for (auto &i : ans) if (i == 0) i = a[2].second; } return ans; } void Read() { } void Solve() { } int32_t main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t(1); if (typetest) cin >> t; for (int _ = 1; _ <= t; ++_) { //cout << "Case #" << _ << ": "; Read(); Solve(); } //cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n"; }

컴파일 시 표준 에러 (stderr) 메시지

split.cpp: In function 'void read(T&)':
split.cpp:12:18: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   12 |     register int c;
      |                  ^
/usr/bin/ld: /tmp/cc0mMRnI.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccWpdFtJ.o:split.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status