제출 #1055622

#제출 시각아이디문제언어결과실행 시간메모리
1055622LeaRouseSplit the Attractions (IOI19_split)C++14
18 / 100
58 ms13140 KiB
#include <bits/stdc++.h> #include "split.h" #define fastio ios_base::sync_with_stdio(0); cin.tie(0); #define ll long long #define ff first #define ss second #define endl '\n' using namespace std; const int MAX=1e5+5; const int MOD=1e8+7; int R[MAX]; int A[MAX]; int B[MAX]; map<string,int>m; vector<int>v[MAX]; bool vis[MAX]; int cont=0; void dfs(int u){ A[cont]=u; cont++; vis[u]=true; for(auto it:v[u]){ if(vis[it]) 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(); for(int i=0;i<m;i++){ v[p[i]].push_back(q[i]); v[q[i]].push_back(p[i]); B[p[i]]++; B[q[i]]++; } bool awa=false; for(int i=0;i<N;i++){ if(B[i]==1){ dfs(i); awa=true; break; } } if(!awa) dfs(0); vector<int>ans(N); for(int i=0;i<a;i++){ ans[A[i]]=1; } for(int i=a;i<a+b;i++){ ans[A[i]]=2; } for(int i=a+b;i<a+b+c;i++){ ans[A[i]]=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...