제출 #742555

#제출 시각아이디문제언어결과실행 시간메모리
742555myrcellaSplit the Attractions (IOI19_split)C++17
11 / 100
77 ms15060 KiB
//by szh #include<bits/stdc++.h> using namespace std; #define fi first #define se second #define pii pair<int,int> #define pll pair<long long,long long> #define pb push_back #define debug(x) cerr<<#x<<"="<<x<<endl #define pq priority_queue #define inf 0x3f #define rep(i,a,b) for (int i=a;i<(b);i++) #define MP make_pair #define SZ(x) (int(x.size())) #define ll long long #define mod 1000000007 #define ALL(x) x.begin(),x.end() void inc(int &a,int b) {a=(a+b)%mod;} void dec(int &a,int b) {a=(a-b+mod)%mod;} int lowbit(int x) {return x&(-x);} ll p0w(ll base,ll p) {ll ret=1;while(p>0){if (p%2ll==1ll) ret=ret*base%mod;base=base*base%mod;p/=2ll;}return ret;} #include "split.h" const int maxn = 2e5+10; vector <int> res; vector <int> edge[maxn]; bool vis[maxn]; int rest; void dfs(int u) { if (rest==0) return; vis[u] = 1; res[u] = 2; rest--; for (int v:edge[u]) { if (vis[v]) continue; dfs(v); } return; } vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) { rep(i,0,SZ(p)) edge[p[i]].pb(q[i]),edge[q[i]].pb(p[i]); res.resize(n); rest = b; dfs(0); bool flag= false; rep(i,0,n) if (!vis[i]) { if (flag==false) res[i] = 1, flag=true; else res[i] = 3; } 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...