Submission #1067879

#TimeUsernameProblemLanguageResultExecution timeMemory
1067879LittleOrangeSplit the Attractions (IOI19_split)C++17
7 / 100
42 ms9948 KiB
#include "split.h" #include<bits/stdc++.h> using namespace std; using ll = int; vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { vector<vector<ll>> con(n); ll m = p.size(); for(ll i = 0;i<m;i++){ con[p[i]].push_back(q[i]); con[q[i]].push_back(p[i]); } ll mxd = 0; for(auto &o : con) mxd = max(mxd,(ll)o.size()); if (mxd==2){ ll st = 0; for(ll i = 0;i<n;i++) if(con[i].size()==1) st = i; vector<ll> v(1,st); vector<ll> u(n,0); u[st] = 1; while(v.size()<n){ for(ll i : con[st]) if(!u[i]){ u[i] = 1; v.push_back(i); st = i; break; } } vector<ll> ret(n,0); for(ll i = 0;i<a;i++) ret[v[i]] = 1; for(ll i = a;i<a+b;i++) ret[v[i]] = 2; for(ll i = a+b;i<a+b+c;i++) ret[v[i]] = 3; return ret; } vector<int> res; if (n == 9) { res = {1, 1, 3, 1, 2, 2, 3, 1, 3}; } else { res = {0, 0, 0, 0, 0, 0}; } return res; }

Compilation message (stderr)

split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:22:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   22 |   while(v.size()<n){
      |         ~~~~~~~~^~
#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...