Submission #391812

#TimeUsernameProblemLanguageResultExecution timeMemory
391812Pichon5Split the Attractions (IOI19_split)C++17
0 / 100
1 ms204 KiB
#include "split.h" #include<bits/stdc++.h> #define lcm(a,b) (a/__gcd(a,b))*b #define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define ll long long int #define vi vector<int> #define vll vector<ll> #define pb push_back #define F first #define S second #define mp make_pair using namespace std; vector<vi>G; vi res; int cant=0; int B; void dfs(int nodo){ if(cant>=B)return; res[nodo]=2; cant++; for(auto it : G[nodo]){ if(res[nodo]==2)continue; dfs(it); } } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { int m=p.size(); G.assign(n,vi()); for(int i=0;i<m;i++){ G[p[i]].pb(q[i]); G[q[i]].pb(p[i]); } res.assign(n,3); dfs(0); for(int i=0;i<n;i++){ if(res[i]==3){ res[i]=1; break; } } return res; }
#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...