Submission #923258

# Submission time Handle Problem Language Result Execution time Memory
923258 2024-02-07T03:56:21 Z MinhAnhnd Speedrun (RMI21_speedrun) C++14
0 / 100
1 ms 508 KB
#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

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 time Memory Grader output
1 Incorrect 0 ms 508 KB setHintLen must not be called more than once
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 508 KB setHintLen must not be called more than once
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 504 KB setHintLen must not be called more than once
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB setHintLen must not be called more than once
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 500 KB setHintLen must not be called more than once
2 Halted 0 ms 0 KB -