Submission #405719

# Submission time Handle Problem Language Result Execution time Memory
405719 2021-05-16T20:23:00 Z ly20 Stations (IOI20_stations) C++17
0 / 100
3000 ms 2097160 KB
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1123;
int marc[MAXN], t;
vector <int> grafo[MAXN];
void dfs(int v, int p) {
    marc[v] = t;
    t++;
    for(int i = 0; i < grafo[v].size(); i++) {
        int viz = grafo[v][i];
        if(viz == p) continue;
        dfs(viz, v);
    }
}
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
	vector<int> labels;
    for(int i = 0; i < n; i++) {
        grafo[u[i]].push_back(v[i]);
        grafo[v[i]].push_back(u[i]);
    }
    dfs(0, 0);
	for (int i = 0; i < n; i++) {
		labels.push_back(marc[i]);
	}
	return labels;
}

int find_next_station(int s, int t, vector<int> c) {
	int rs = -1;
	for(int i= 0; i < c.size(); i++) {
        int viz = c[i];
        if(viz <= t || c[i] < s) rs = max(rs, viz);
	}
	return rs;
}

Compilation message

stations.cpp: In function 'void dfs(int, int)':
stations.cpp:10:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |     for(int i = 0; i < grafo[v].size(); i++) {
      |                    ~~^~~~~~~~~~~~~~~~~
stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:31:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |  for(int i= 0; i < c.size(); i++) {
      |                ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 1351 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3038 ms 1964 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1492 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 991 ms 400 KB Output is correct
2 Runtime error 1105 ms 2097156 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1195 ms 2097160 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -