Submission #1063710

#TimeUsernameProblemLanguageResultExecution timeMemory
1063710aaaaaarrozSplit the Attractions (IOI19_split)C++17
0 / 100
1 ms348 KiB
#include "split.h" #include<bits/stdc++.h> using namespace std; vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { vector<vector<int>>graph(n,vector<int>()); for(int i=0;i<q.size();i++){ graph[p[i]].push_back(q[i]); graph[q[i]].push_back(p[i]); } int pivot=0; vector<int>nodes; queue<int>cola; cola.push(pivot); vector<bool>v(n,false); v[pivot]=true; nodes.push_back(pivot); while(!cola.empty()&&nodes.size()<max(b,c)){ int nodo=cola.front(); cola.pop(); nodes.push_back(nodo); for(int vecino:graph[nodo]){ v[vecino]=true; cola.push(vecino); } } vector<int>ans(n,0); ans[cola.front(),0]=1; if(b>c){ for(int nodo:nodes){ ans[nodo]=2; } for(int i=0;i<n;i++){ if(ans[i]==0){ ans[i]=3; } } } else{ for(int nodo:nodes){ ans[nodo]=3; } for(int i=0;i<n;i++){ if(ans[i]==0){ ans[i]=2; } } } return ans; }

Compilation message (stderr)

split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:6:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    6 |  for(int i=0;i<q.size();i++){
      |              ~^~~~~~~~~
split.cpp:17:35: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'const int' [-Wsign-compare]
   17 |  while(!cola.empty()&&nodes.size()<max(b,c)){
      |                       ~~~~~~~~~~~~^~~~~~~~~
#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...