Submission #541582

# Submission time Handle Problem Language Result Execution time Memory
541582 2022-03-23T19:26:10 Z Vladth11 Stations (IOI20_stations) C++14
0 / 100
3000 ms 2097152 KB
#include <bits/stdc++.h>
#include "stations.h"
#define debug(x) cerr << #x << " " << x << "\n"
#define debugs(x) cerr << #x << " " << x << " "

using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <long double, pii> muchie;

const ll NMAX = 1001;
const ll VMAX = 1000001;
const ll INF = (1LL << 60);
const ll MOD = 1000000007;
const ll BLOCK = 1000000;
const ll nr_of_bits = 16;

vector <int> sol;
vector <int> g[NMAX];
int stamp;

void DFS(int node, int p){
    for(auto x : g[node]){
        if(x == p)
            continue;
        DFS(x, node);
    }
    sol[node] = stamp++;
}

vector<int> label(int n, int k, vector<int> u, vector<int> v) {
	sol.resize(n);
	for (int i = 0; i < n - 1; i++) {
        int a = u[i];
        int b = v[i];
        g[a].push_back(b);
        g[b].push_back(a);
	}
    DFS(0, -1);
    return sol;
}

int find_next_station(int s, int t, vector<int> c) {
    sort(c.begin(), c.end());
    for(int i = 0; i < c.size() - 1; i++){
        if(t <= c[i]){
            return c[i];
        }
    }
    return c.back();
}


Compilation message

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:45:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |     for(int i = 0; i < c.size() - 1; i++){
      |                    ~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 1646 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3034 ms 336 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1368 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 851 ms 416 KB Output is correct
2 Runtime error 1030 ms 2097152 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2454 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -