제출 #1042476

#제출 시각아이디문제언어결과실행 시간메모리
1042476yanb수천개의 섬 (IOI22_islands)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; //#define int long long //#define pii pair<long long, long long> union Ans { bool b; vector<int> v; Ans(bool b) : b(b) {} Ans(vector<int> v) : v(v) {} ~Ans() {} Ans(const Ans&) {} }; Ans n2(int n, int M, vector<int> U, vector<int> V) { vector<int> u0, u1; for (int i = 0; i < M; i++) { if (U[i]) u1.push_back(i); else u0.push_back(i); } if (u1.size() > 0 && u0.size() > 1) { vector<int> ans = {u0[0], u1[0], u0[1], u0[0], u1[0], u0[1]}; return ans; } else { return false; } } void dfs(int v, vector<vector<int>> &g, vector<bool> &uu) { if (uu[v]) return; uu[v] = 1; for (int u : g[v]) { dfs(u, g, uu); } } Ans undirected(int n, int M, vector<int> U, vector<int> V) { vector<vector<int>> g(n); for (int i = 0; i < M; i++) { g[U[i]].push_back(V[i]); } if (g[0].size() > 1) return true; vector<bool> uu(n); dfs(0, g, uu); for (int i = 0; i < n; i++) { if (g[i].size() > 2 && uu[i]) return true; } return false; } Ans find_journey(int n, int M, vector<int> U, vector<int> V) { if (n == 2) return n2(n, M, U, V); return undirected(n, M, U, V); } #ifndef ONLINE_JUDGE signed main() { Ans ans = find_journey(3, 4, {0, 1, 1, 0}, {1, 0, 0, 1}); if (ans.b) { for (int x : ans.v) cout << x << " "; cout << "\n"; } } #endif

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

/usr/bin/ld: /tmp/ccebqdxb.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc4W1sya.o:islands.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status