제출 #718145

#제출 시각아이디문제언어결과실행 시간메모리
718145mseebacherSplit the Attractions (IOI19_split)C++17
0 / 100
57 ms9216 KiB
#include "split.h" #include <bits/stdc++.h> using namespace std; #define MAX_N (int) 1e5+5 vector<int> ad[MAX_N]; vector<int> res; vector<bool> vis(MAX_N); void dfs(int x,int cnt,char side){ if(vis[x] || cnt == 0) return; vis[x] = 1; if(cnt >0){ if(side == 'b'){ res[x] = 2; }else{ res[x] = 3; } cnt--; } for(auto s: ad[x]){ dfs(s,cnt,side); } } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { for(int i = 0;i<(int)p.size();i++){ ad[p[i]].push_back(q[i]); ad[q[i]].push_back(p[i]); } res.assign(n,0); if(p.size() < n-1) return res; if(b < c){ res.assign(n,3); dfs(0,b,'b'); for(int i = 0;i<n;i++){ if(res[i] == 3){ res[i] = 1; break; } } }else{ res.assign(n,2); dfs(0,c,'c'); for(int i = 0;i<n;i++){ if(res[i] == 2){ 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:34:14: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   34 |  if(p.size() < n-1) return res;
      |     ~~~~~~~~~^~~~~
#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...