Submission #429750

#TimeUsernameProblemLanguageResultExecution timeMemory
429750rumen_mSplit the Attractions (IOI19_split)C++17
11 / 100
114 ms12772 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) { if(leftt==0)return ; leftt--; res[v] = 2; int i; for(auto u:g[v]) { if(res[u]!=0)continue; 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:13:9: warning: unused variable 'i' [-Wunused-variable]
   13 |     int i;
      |         ^
split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:26:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |  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...