Submission #520719

#TimeUsernameProblemLanguageResultExecution timeMemory
520719peti1234Split the Attractions (IOI19_split)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int n, m, db[4]; vector<int> valasz, el[100000]; void dfs(int a, int ert) { if (!db[ert]) return; valasz[a]=ert; db[ert]--; for (auto x:el[a]) { if (!valasz[x]) { dfs(x, ert); } } } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { int m=p.size(); db[1]=a, db[2]=b, db[3]=c; for (int i=0; i<m; i++) { int x=p[i], y=q[i]; el[x].push_back(y), el[y].push_back(x); } valasz.resize(n); // 2 if (a==1) { dfs(0, 2); for (int i=0; i<n; i++) { if (!valasz[i]) { if (db[1]) { valasz[i]=1; db[1]--; } else { valasz[i]=3; db[3]--; } } } return valasz; } // 1 if (m<n) { // lanc for (int i=0; i<n; i++) { if (el[i].size()==1) { if (db[1]) { dfs(i, 1); } else { dfs(i, 2); } } } } else { // kor dfs(0, 1); for (int i=0; i<n; i++) { if (!valasz[i] && db[2]) { dfs(i, 2); } } } for (int i=0; i<n; i++) { if (!valasz[i]) { valasz[i]=3; db[3]--; } } return valasz; } int main() { return 0; } /* int b1, b2, b3, b4, b5; vector<int> b6, b7, b8; int main() { cin >> b1 >> b2 >> b3 >> b4 >> b5; for (int i=1; i<=b2; i++) {int x; cin >> x; b6.push_back(x);} for (int i=1; i<=b2; i++) {int x; cin >> x; b7.push_back(x);} b8=find_split(b1, b3, b4, b5, b6, b7); for (int i=0; i<b8.size(); i++) cout << b8[i] << " "; return 0; } /* 9 10 3 3 3 0 0 0 0 0 0 1 2 4 5 1 3 4 6 7 8 2 3 5 6 */

Compilation message (stderr)

split.cpp:88:1: warning: "/*" within comment [-Wcomment]
   88 | /*
      |  
/usr/bin/ld: /tmp/ccbBjgtK.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cclYDjjK.o:split.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status