Submission #291173

#TimeUsernameProblemLanguageResultExecution timeMemory
291173Dremix10Split the Attractions (IOI19_split)C++17
18 / 100
120 ms15096 KiB
#include "split.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef unsigned long long ull; typedef pair<int,int> pi; typedef pair<ll,ll> pl; #define F first #define S second #define endl '\n' #define all(x) (x).begin(),(x).end() #ifdef dremix #define p(x) cerr<<#x<<" = "<<x<<endl; #define p2(x,y) cerr<<#x<<" , "<<#y<<" = "<<x<<" , "<<y<<endl; #define pp(x) cerr<<#x<<" = ("<<x.F<<" , "<<x.S<<")"<<endl; #define pv(x) cerr<<#x<<" = {";for(auto u : x)cerr<<u<<", ";cerr<<"}"<<endl; #define ppv(x) cerr<<#x<<" = {";for(auto u : x)cerr<<u.F<<"-"<<u.S<<", ";cerr<<"}"<<endl; #else #define p(x) #define p2(x,y) #define pp(x) #define pv(x) #define ppv(x) #endif #define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); const int maxp = 22; const ld EPS = 1e-18; const ll INF = 1e18; const int MOD = 1e9+7; const int N = 2e5+1; vector<vector<int> > adj(N); vector<int> res; bool v[N]; int siz[3]; int curr,cnt; void dfs(int s){ cnt++; if(cnt==siz[curr-1]+1){ curr++; cnt = 1; } v[s] = 1; res[s] = curr; for(auto x : adj[s]) if(!v[x]) dfs(x); } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { siz[0] = a; siz[1] = b; siz[2] = c; int i; for(i=0;i<p.size();i++){ int x = p[i],y = q[i]; adj[x].push_back(y); adj[y].push_back(x); } res.assign(n,0); int start = 0; for(i=0;i<n;i++) if(adj[i].size()==1)start = i; curr = 1; cnt = 0; dfs(start); 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:57:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 |  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...