제출 #521018

#제출 시각아이디문제언어결과실행 시간메모리
521018Valaki2Split the Attractions (IOI19_split)C++14
11 / 100
82 ms10728 KiB
#include "split.h" using namespace std; #include <iostream> /* 10 9 3 5 2 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 0 */ int hatra; vector<int> res; vector<vector<int> > g; void dfs(int x) { if(!hatra) return; hatra--; res[x] = 2; for(int y : g[x]) { if(res[y] == 3) { dfs(y); } } } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { res.assign(n, 3); g.resize(n); for(int i = 0; i < p.size(); i++) { g[p[i]].push_back(q[i]); g[q[i]].push_back(p[i]); } hatra = b; dfs(1); for(int i = 0; i < n; i++) { if(res[i] == 3) { res[i] = 1; break; } } return res; }

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

split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:39:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |  for(int i = 0; i < p.size(); i++) {
      |                 ~~^~~~~~~~~~
#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...