제출 #644424

#제출 시각아이디문제언어결과실행 시간메모리
644424a_aguiloSplit the Attractions (IOI19_split)C++14
0 / 100
0 ms300 KiB
#include "split.h" #include<bits/stdc++.h> using namespace std; vector<int> res; vector<vector<int>> listaAdy; int cnt, A, B, C; void dfs(int node){ //cout << node << endl; if(cnt <= A) res[node] = 1; else if (cnt <= B) res[node] = 2; else res[node] = 3; cnt++; for(int neighbour: listaAdy[node]){ if(res[neighbour] == -1) dfs(neighbour); } } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { res = vector<int>(n, -1); A = a; B = b; C = c; listaAdy = vector<vector<int>> (n); for(int i = 0; i < p.size(); ++i){ listaAdy[p[i]].push_back(q[i]); listaAdy[q[i]].push_back(p[i]); } int start = -1; for(int i = 0; i < n; ++i){ if(listaAdy[i].size() <= 1){ start = i; break; } } cnt = 1; dfs(start); //cout << "a "<< endl; return res; }

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

split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:27:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |  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...