# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
372841 |
2021-03-02T01:03:58 Z |
Ozy |
Stations (IOI20_stations) |
C++17 |
|
3000 ms |
2097156 KB |
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int i = (a); i <= (b); i++)
#define repa(i,a,b) for (int i = (a); i >= (b); i--)
#define lli int
#define debug(a) cout << #a << ' ' << a << endl
lli cont;
vector<lli> hijos[1002],res;
void llena(lli pos, lli padre, lli pp) {
if (pp == 1) res[pos] = cont++;
for (auto h : hijos[pos]) {
if (h == padre) continue;
if (pp == 1) llena(h,pos,0);
else llena(h,pos,1);
}
if (pp == 0) res[pos] = cont++;
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
res.resize(n);
rep(i,0,n-2) {
hijos[u[i]].push_back(v[i]);
hijos[v[i]].push_back(u[i]);
}
cont = 0;
llena(0,-1,1);
return res;
}
int find_next_station(int s, int t, std::vector<int> c) {
int ini,fin;
ini = c[0];
fin = c[c.size()-1];
if (ini > s) {
if (t < s) return fin;
if (t > fin) return fin;
for (auto h : c) {
if (t <= h && t >= s) return h;
}
}
else {
if (t > s) return ini;
if (t < ini) return ini;
for (auto h : c) {
if (t >= h && t <= s) return h;
}
}
}
Compilation message
stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:62:1: warning: control reaches end of non-void function [-Wreturn-type]
62 | }
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1458 ms |
2097156 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3036 ms |
636 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1553 ms |
2097156 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
937 ms |
864 KB |
Output is correct |
2 |
Runtime error |
1208 ms |
2097156 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2984 ms |
2097156 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |