# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
923258 | MinhAnhnd | Speedrun (RMI21_speedrun) | C++14 | 1 ms | 508 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 "speedrun.h"
#include <bits/stdc++.h>
using namespace std;
void assignHints(int subtask, int N, int A[], int B[]) { /* your solution here */
bool leaf[N+1];
bool visited[N+1];
long parent[N+1];
long first_val[N+1];
long second_val[N+1];
stack<long> tovisit;
setHintLen(20);
vector<long> adjlist[N+1];
vector<long> leaves;
for (int i = 1;i<=N;i++){
leaf[i] = 1;
parent[i] = 0;
visited[i] = 0;
first_val[i] = -1;
second_val[i] = -1;
}
setHintLen(N);
for(int i = 1;i<N;i++){
adjlist[A[i]].push_back(B[i]);
adjlist[B[i]].push_back(A[i]);
}
tovisit.push(1);
while(!tovisit.empty()){
long current = tovisit.top();
tovisit.pop();
if(visited[current]) continue;
visited[current]=1;
for (auto i:adjlist[current]){
if(!visited[i]){
leaf[current] = 0;
parent[i] = current;
tovisit.push(i);
}
}
}
for (int i = 1;i<=N;i++){
if (leaf[i]){
leaves.push_back(i);
}
}
for (auto green: leaves){
}
}
void speedrun(int subtask, int N, int start) { /* your solution here */
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |