Submission #386041

#TimeUsernameProblemLanguageResultExecution timeMemory
386041rocks03Split the Attractions (IOI19_split)C++14
0 / 100
10 ms9964 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define pii pair<int, int> #define pll pair<ll, ll> #define ff first #define ss second #define pb push_back #define SZ(x) ((int)(x).size()) #define all(x) x.begin(), x.end() #define debug(x) cout << #x << ": " << x << " " #define nl cout << "\n" #define rep(i, a, b) for(int i = (a); i < (b); i++) #define per(i, a, b) for(int i = (a); i >= (b); i--) mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const int MAXN = 2e5+100; vector<int> g[MAXN]; vector<int> find_split(int N, int a, int b, int c, vector<int> p, vector<int> q) { rep(i, 0, SZ(p)){ g[p[i]].pb(q[i]); g[q[i]].pb(p[i]); } vector<int> ans(N); bool subtask1 = true; rep(i, 0, N) subtask1 &= (SZ(g[i]) <= 2); if(subtask1){ int v = -1; rep(i, 0, N){ if(SZ(g[i]) == 1) v = i; } queue<int> q; q.push(v); while(!q.empty()){ int v = q.front(); q.pop(); if(a) ans[v] = 1, --a; else if(b) ans[v] = 2, --b; else if(c) ans[v] = 3, --c; for(int u : g[v]){ if(!ans[u]) q.push(u); } } return ans; } if(a == 1){ queue<int> q; q.push(0); ans[0] = 2; while(!q.empty()){ int v = q.front(); q.pop(); for(int u : g[v]){ if(!ans[u]){ if(b) ans[u] = 2, --b; else if(c) ans[u] = 3, --c; else if(a) ans[u] = 1, --a; q.push(u); } } } 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:63:1: warning: control reaches end of non-void function [-Wreturn-type]
   63 | }
      | ^
#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...