Submission #429747

#TimeUsernameProblemLanguageResultExecution timeMemory
429747rumen_mSplit the Attractions (IOI19_split)C++17
0 / 100
3 ms2652 KiB
#include "split.h" #include <bits/stdc++.h> using namespace std; const int maxn = 1e5+5; vector<int> res; vector <int> g[maxn]; int leftt; void dfs(int v, int par) { res[v] = 2; int i; if(leftt==0)return ; for(auto u:g[v]) { if(res[u]!=0)continue; leftt--; dfs(u,v); } } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { res.resize(n); int i; for(i=0;i<p.size();i++) { g[p[i]].push_back(q[i]); g[q[i]].push_back(p[i]); } if(a==1) { leftt = b; dfs(0,-1); bool fl = false; for(i=0;i<n;i++) { if(res[i])continue; if(!fl){res[i] = 1; fl=true;} else res[i] = 3; } } return res; }

Compilation message (stderr)

split.cpp: In function 'void dfs(int, int)':
split.cpp:11:9: warning: unused variable 'i' [-Wunused-variable]
   11 |     int i;
      |         ^
split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:24:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |  for(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...