# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
110505 | tjd229 | Easter Eggs (info1cup17_eastereggs) | C++14 | 27 ms | 384 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
//#include<vector>
//#include<queue>
//#include <set>
#include "grader.h"
#define pii pair<int,int>
using namespace std;
int p[513],d[513];
vector<int> order;
void dfs(int x,int from,vector<int> *edge) {
order.push_back(x);
p[x] = from;
for (auto nxt : edge[x]) {
if (nxt != from) {
d[nxt] = d[x] + 1;
dfs(nxt, x, edge);
}
}
}
void make_beauty(vector<int> &tree) {
set<pii > st;//depth,x
for (auto x : tree) {
st.insert({-d[x],x});
}
while (st.size() > 1) {
int depth = st.begin()->first;
while (st.begin()->first ==depth) {
int par = p[st.begin()->second];
if (st.find({ -d[par],par }) == st.end()) {
tree.push_back(par);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |