답안 #350197

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
350197 2021-01-19T04:10:43 Z talant117408 기지국 (IOI20_stations) C++17
0 / 100
3000 ms 2097156 KB
#include "stations.h"
#include <bits/stdc++.h>
#ifndef EVAL
#include "stub.cpp"
#endif
using namespace std;

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

#define precision(n) fixed << setprecision(n)
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define mp make_pair
#define eps (double)1e-9
#define PI 2*acos(0.0)
#define endl "\n"
#define sz(v) int((v).size())
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define do_not_disturb ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define OK cout << "OK" << endl;

vector <vector <int>> graph(1003);
int timer = -1, num[1003];

void dfs(int v, int p = 0){
    num[v] = ++timer;
    for(auto to : graph[v]){
        if(to != p){
            dfs(to, v);
        }
    }
}

vector<int> label(int n, int k, vector<int> u, vector<int> v){
    vector <int> labels(n);
    for(int i = 0; i < sz(u); i++){
        graph[u[i]].pb(v[i]);
        graph[v[i]].pb(u[i]);
    }
    dfs(0);
    for(int i = 0; i < n; i++){
        labels[i] = num[i];
    }
    return labels;
}

int find_next_station(int s, int t, vector<int> c){
	if(t <= c[0]) return c[0];
    auto it = lb(all(c), t);
    if(it == c.end()){
        it--;
        return *it;
    }
    else if(*it == t) return t;
    else{
        it--;
        return *it;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1600 ms 2097156 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3008 ms 520 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1723 ms 2097156 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 951 ms 948 KB Output is correct
2 Runtime error 1330 ms 2097152 KB Execution killed with signal 9 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2989 ms 2097156 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -