Submission #803071

# Submission time Handle Problem Language Result Execution time Memory
803071 2023-08-02T21:12:03 Z HaroldVemeno Stations (IOI20_stations) C++17
0 / 100
3000 ms 2097152 KB
#include "stations.h"
#include <bits/stdc++.h>

#ifdef GUDEB
    #define D(x) cerr << #x << ": " << (x) << '\n';
    #define ifdeb if(true)
#else
    #define D(x) ;
    #define ifdeb if(false)
#endif

#define all(x) begin(x), end(x)

using namespace std;
using ull = unsigned long long;
using ll = long long;
// #define int ll;

vector<int> al[1000];
vector<int> labels;
int t = 0;

void dfs(int v, int p) {
    for(auto a : al[v]) {
        if(a == p) continue;
        dfs(a, v);
    }
    labels[v] = t++;
}

vector<int> label(int n, int k, vector<int> u, vector<int> v) {
	for (int i = 0; i < u.size(); i++) {
        al[u[i]].push_back(v[i]);
        al[v[i]].push_back(u[i]);
	}
    labels.resize(n);
    dfs(0, 0);
	return labels;
}

int find_next_station(int s, int t, vector<int> c) {
    sort(all(c));
    for(int a : c) {
        if(a >= t) return a;
    }
    return c.back();
}

Compilation message

stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:32:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |  for (int i = 0; i < u.size(); i++) {
      |                  ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 1375 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3036 ms 416 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1059 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 689 ms 456 KB Output is correct
2 Runtime error 843 ms 2097152 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1856 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -