답안 #306893

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
306893 2020-09-26T13:52:58 Z giorgikob 기지국 (IOI20_stations) C++14
0 / 100
3 ms 768 KB
#include "stations.h"
#include <vector>
#include<bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define pb push_back
using namespace std;

const int N = 1e3+5;

vector<int>gr[N];

int cnt = 0;
int fix[N];
//int c = 0;

void dfs(int x, vector<int>&v){
    fix[x] = 1;
    v[x] = cnt; cnt++;
    for(auto to : gr[x]){
        if(fix[to]) continue;
        dfs(to,v);
    }
}

std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
	std::vector<int> labels(n);
	for (int i = 0; i < n; i++) {
		//labels[i] = i;
		//cnt++;
	}

	for(int i = 0; i < n; i++){
        int x = u[i];
        int y = v[i];
        gr[x].pb(y);
        gr[y].pb(x);
	}
    cnt = 0;
	for(int i = 0; i < n; i ++){
        if(gr[i].size() == 1){
            dfs(i,labels);
        }
	}

	return labels;
}

int find_next_station(int s, int t, std::vector<int> c) {
    if(c.size() == 1) return c[0];
    if(s > t) return c[0];
	return c[1];
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 756 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 768 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 392 KB Invalid labels (duplicates values). scenario=1, label=0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 652 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -