Submission #1106129

# Submission time Handle Problem Language Result Execution time Memory
1106129 2024-10-29T10:26:22 Z snpmrnhlol Stations (IOI20_stations) C++17
0 / 100
783 ms 668 KB
#include "stations.h"
#include <vector>
using namespace std;
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
    vector <vector<int>> e;
    vector<int> labels;
    e.resize(n);
    int cnt = 0;
    auto dfs = [&](auto self,int node, int p) -> void{
        for(auto i:e[node]){
            if(i == p)continue;
            self(self, i, node);
        }
        labels[node] = cnt++;
    };
	labels.resize(n);
	for(int i = 0;i < n - 1;i++){
        e[u[i]].push_back(v[i]);
        e[v[i]].push_back(u[i]);
	}
	dfs(dfs, 0, -1);
	return labels;
}

int find_next_station(int s, int t, std::vector<int> c) {
    if(s < t){
        ///s go up
        int mx = -1;
        for(auto i:c){
            mx = max(mx,i);
        }
        return mx;
    }else{
        ///s go down?
        int mn = 1000000;
        for(auto i:c){
            if(i < mn && t <= i){
                mn = i;
            }
        }
        return mn;
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 471 ms 668 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 389 ms 668 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 489 ms 668 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 783 ms 668 KB Output is correct
2 Correct 573 ms 668 KB Output is correct
3 Incorrect 557 ms 668 KB Wrong query response.
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 474 ms 668 KB Wrong query response.
2 Halted 0 ms 0 KB -