Submission #736736

#TimeUsernameProblemLanguageResultExecution timeMemory
736736bobthebuilderSplit the Attractions (IOI19_split)C++17
0 / 100
3 ms2660 KiB
#include "split.h" #include<bits/stdc++.h> using namespace std; #define sz(x) (int)x.size() #define REP(i,n) for(int i=0;i<n;i++) #define REP1(i,n) for(int i=1;i<=n;i++) #define pb push_back #define lowb(x) (x&(-x)) #define ALL(_x) _x.begin(),_x.end() #define pii pair<int,int> #define f first #define s second #define SORT_UNIQUE(x) sort(ALL(x)),x.erase(unique(ALL(x)),x.end()) const int maxn=1e5+5; #define ll long long vector<int> v[maxn]; bool vis[maxn]; vector<int> top; void dfs(int u){ vis[u]=1; for(int x:v[u]){ if(!vis[x]) dfs(x); } top.pb(u); } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { vector<int> ans(n,0); REP(i,sz(p)){ v[p[i]].pb(q[i]),v[q[i]].pb(p[i]); } if(a==1){ } else if(sz(p)==n-1){ } else{ REP(i,n){ if(sz(v[i])==1){ dfs(i); break; } } REP(i,a) ans[top[i]]=1; REP(i,b) ans[top[i+a]]=2; REP(i,c) ans[top[i+a+b]]=3; } return ans; }
#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...