Submission #308546

# Submission time Handle Problem Language Result Execution time Memory
308546 2020-10-01T14:28:33 Z xt0r3 Stations (IOI20_stations) C++14
0 / 100
1 ms 640 KB
#include<bits/stdc++.h>
#include "stations.h"
using namespace std;


constexpr int N = 2005;
int n, timer;
vector<int> l, d;
vector<bool> visited;
vector<vector<int> > edges;

void dfs(int id){
    visited[id] = 1;
    d[id] = timer++;
    for(int v : edges[id]){
        if(!visited[v]) dfs(v);
    }
    l[id] = timer++;
}

std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v){
    edges.resize(n, vector<int>());
    visited.resize(n, 0);
    l.resize(n);
    d.resize(n);
    vector<int> label(n);
    for(int i = 0; i < n; i++){
        edges[u[i]].push_back(v[i]);
        edges[v[i]].push_back(u[i]);
    }
    for(int i = 0; i < n; i++){
        label[i] = N * d[i] + l[i];
    }
}

int find_next_station(int s, int t, std::vector<int> c){
    int ti = t / N, tl = t % N;
    vector<int> v;
    for(int x : c){
        int ci = x / N, cl = x % N;
        v.push_back(ci);
        if(ci < ti && tl < cl) return x;
    }
    int dex = min_element(v.begin(), v.end()) - v.begin();
    return c[dex];
}

Compilation message

stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:34:1: warning: no return statement in function returning non-void [-Wreturn-type]
   34 | }
      | ^
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -