제출 #368377

#제출 시각아이디문제언어결과실행 시간메모리
368377leinad2Split the Attractions (IOI19_split)C++17
7 / 100
2075 ms9068 KiB
#include "split.h" #include<bits/stdc++.h> using namespace std; vector<int>adj[100010]; int i, j, k, cnt; vector<int>find_split(int n, int a, int b, int c, vector<int>p, vector<int>q) { vector<int>res(n); for(i=0;i<n-1;i++) { adj[p[i]].push_back(q[i]); adj[q[i]].push_back(p[i]); } for(i=0;i<n;i++)if(adj[i].size()==1)break; res[i]=++cnt; i=adj[i][0]; while(1) { res[i]=++cnt; if(adj[i].size()==1)break; if(res[adj[i][0]])i=adj[i][1]; else i=adj[i][0]; } for(i=0;i<n;i++) { if(res[i]<=a)res[i]=1; else if(res[i]<=b+a)res[i]=2; 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...