답안 #1106135

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1106135 2024-10-29T10:44:29 Z snpmrnhlol 기지국 (IOI20_stations) C++17
5 / 100
834 ms 928 KB
#include "stations.h"
#include <vector>
#include <iostream>
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{
        labels[node] = cnt++;
        for(auto i:e[node]){
            if(i == p)continue;
            self(self, i, node);
        }
    };
	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]);
	}
	for(int i = 0;i < n;i++){
        if(e[i].size() == 1){
            dfs(dfs, i, -1);
            break;
        }
	}
	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){
            mn = min(mn,i);
        }
        return mn;
    }
}
/**
1
7 99
0 1
0 2
1 3
1 4
2 5
2 6
**/
# 결과 실행 시간 메모리 Grader output
1 Correct 496 ms 668 KB Output is correct
2 Correct 409 ms 668 KB Output is correct
3 Correct 778 ms 668 KB Output is correct
4 Correct 612 ms 668 KB Output is correct
5 Correct 550 ms 668 KB Output is correct
6 Correct 413 ms 668 KB Output is correct
7 Correct 387 ms 668 KB Output is correct
8 Correct 2 ms 752 KB Output is correct
9 Correct 3 ms 752 KB Output is correct
10 Correct 2 ms 928 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 429 ms 924 KB Wrong query response.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 475 ms 668 KB Output is correct
2 Correct 424 ms 668 KB Output is correct
3 Correct 834 ms 668 KB Output is correct
4 Correct 601 ms 668 KB Output is correct
5 Correct 496 ms 668 KB Output is correct
6 Correct 415 ms 668 KB Output is correct
7 Correct 404 ms 668 KB Output is correct
8 Correct 2 ms 920 KB Output is correct
9 Correct 3 ms 756 KB Output is correct
10 Correct 2 ms 752 KB Output is correct
11 Incorrect 549 ms 668 KB Wrong query response.
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 832 ms 668 KB Output is correct
2 Correct 603 ms 668 KB Output is correct
3 Correct 530 ms 668 KB Output is correct
4 Correct 2 ms 752 KB Output is correct
5 Correct 4 ms 752 KB Output is correct
6 Correct 2 ms 752 KB Output is correct
7 Incorrect 534 ms 668 KB Wrong query response.
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 463 ms 668 KB Output is correct
2 Correct 400 ms 668 KB Output is correct
3 Correct 828 ms 668 KB Output is correct
4 Correct 587 ms 836 KB Output is correct
5 Correct 556 ms 668 KB Output is correct
6 Correct 416 ms 668 KB Output is correct
7 Correct 416 ms 668 KB Output is correct
8 Correct 2 ms 752 KB Output is correct
9 Correct 3 ms 752 KB Output is correct
10 Correct 2 ms 752 KB Output is correct
11 Incorrect 390 ms 668 KB Wrong query response.
12 Halted 0 ms 0 KB -