제출 #294474

#제출 시각아이디문제언어결과실행 시간메모리
294474albertolg101Split the Attractions (IOI19_split)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> //#include "split.h" using namespace std; vector<int> a_is_equal_to_one (int b, int c, int n, vector<vector<int>> &G) { vector<bool> flag(n); int cnt = 1; function<void(int)> dfs1 = [&]( int nod ) { for(auto i: G[nod]) { if( cnt == b ) return ; if(flag[i]) continue; flag[i] = 1; cnt++; dfs1(i); } } ; flag[0] = true; dfs1(0); bool a = false ; vector<int> ans(n); for( int i = 0 ; i < n ; i++ ) { if( flag[i] ) ans[i] = 2 ; else if( a ) ans[i] = 3 ; else ans[i] = 1, a = true; } return ans ; } vector<int> is_a_line (int a, int b, int c, int n, vector<vector<int>> &G) { int root = 0; for( int i = 0 ; i < n ; i++ ) if( G[i].size() == 1 ) root = i ; vector<int> ans(n); function<void(int, int)> dfs = [&](int nod, int lvl) { if( lvl <= a ) ans[nod] = 1; else if( lvl <= a + b ) ans[nod] = 2 ; else ans[nod] = 3 ; for( auto target : G[nod] ) { if( ans[target] == 0 ) dfs( target , lvl + 1 ) ; } } ; dfs(root, 1); return ans; } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { vector<vector<int>> G(n + 1); int m = p.size(), degree = 0; for(int i = 0; i < m; i++) { G[p[i]].push_back(q[i]); G[q[i]].push_back(p[i]); degree = max({ degree, (int)G[p[i]].size() , (int)G[q[i]].size() }); } if(a == 1) return a_is_equal_to_one(b, c, n, G); else return is_a_line(a, b, c, n, G); } int main() { int n, m, a, b, c; assert(5 == scanf("%d%d%d%d%d", &n, &m, &a, &b, &c)); vector<int> p(m), q(m); for (int i=0; i<m; i++) assert(2 == scanf("%d%d", &p[i], &q[i])); fclose(stdin); vector<int> result = find_split(n, a, b, c, p, q); for (int i=0; i<(int)result.size(); i++) printf("%s%d", ((i>0)?" ":""), result[i]); printf("\n"); fclose(stdout); return 0; }

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

/tmp/ccIGj7aL.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccNCjucn.o:split.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status