제출 #520718

#제출 시각아이디문제언어결과실행 시간메모리
520718peti1234Split the Attractions (IOI19_split)C++17
11 / 100
70 ms12572 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 for (int i=0; i<n; i++) { if (el[i].size()==1) { if (db[1]) { dfs(i, 1); } else { dfs(i, 2); } } for (int i=0; i<n; i++) { if (!valasz[i]) { valasz[i]=3; db[3]--; } } return valasz; } }

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

split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:61:1: warning: control reaches end of non-void function [-Wreturn-type]
   61 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...