답안 #334118

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
334118 2020-12-08T11:04:27 Z rocks03 기지국 (IOI20_stations) C++14
0 / 100
6 ms 1420 KB
#include "stations.h"
//#pragma GCC target("avx2")
//#pragma GCC optimization("O3")
//#pragma GCC optimization("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ff first
#define ss second
#define pb push_back
#define SZ(x) ((int)(x).size())
#define all(x) x.begin(), x.end()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int t;
vector<int> mn;
vector<vector<int>> g;

void dfs(int v, int p, vector<int>& labels){
    int m = INT_MAX;
    for(auto u : g[v]){
        if(u == p)
            continue;
        dfs(u, v, labels);
        m = min(m, mn[u]);
    }
    labels[v] = t++;
    mn[labels[v]] = min(m, labels[v]);
}

vector<int> label(int n, int k, vector<int> u, vector<int> v){
	g.resize(n);
	for(int i = 0; i < n; i++){
        g[i].clear();
	}
	for(int i = 0; i < n-1; i++){
	    g[u[i]].pb(v[i]);
	    g[v[i]].pb(u[i]);
	}
	vector<int> labels(n);
    t = 0;
	mn.resize(n);
	dfs(0, -1, labels);
	return labels;
}

int find_next_station(int s, int t, vector<int> c){
	for(auto x : c){
	    if(x >= t && mn[x] <= t){
	        return x;
	    }
	}
	return c.back();
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 1420 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 992 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 1120 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 864 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 1136 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -