Submission #923260

#TimeUsernameProblemLanguageResultExecution timeMemory
923260MinhAnhndSpeedrun (RMI21_speedrun)C++14
0 / 100
1 ms932 KiB
#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)

speedrun.cpp: In function 'void assignHints(int, int, int*, int*)':
speedrun.cpp:47:15: warning: unused variable 'green' [-Wunused-variable]
   47 |     for (auto green: leaves){
      |               ^~~~~
speedrun.cpp:7:10: warning: variable 'parent' set but not used [-Wunused-but-set-variable]
    7 |     long parent[N+1];
      |          ^~~~~~
speedrun.cpp:8:10: warning: variable 'first_val' set but not used [-Wunused-but-set-variable]
    8 |     long first_val[N+1];
      |          ^~~~~~~~~
speedrun.cpp:9:10: warning: variable 'second_val' set but not used [-Wunused-but-set-variable]
    9 |     long second_val[N+1];
      |          ^~~~~~~~~~
#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...