# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
391489 |
2021-04-18T22:20:46 Z |
ljuba |
Stations (IOI20_stations) |
C++17 |
|
1968 ms |
2097156 KB |
#include "stations.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
const int mxN = 1100;
vector<int> adj[mxN];
std::vector<int> labels;
int timer = 0;
void dfs(int s, int p = -1, int pa = 0) {
if(pa^1)
labels[s] = timer++;
for(auto e : adj[s]) {
if(e == p) continue;
dfs(e, s, pa^1);
}
if(pa)
labels[s] = timer++;
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
for(int i = 0; i < n; ++i) {
adj[u[i]].push_back(v[i]);
adj[v[i]].push_back(u[i]);
}
labels.resize(n);
dfs(0);
return labels;
}
int find_next_station(int s, int t, std::vector<int> c) {
sort(c.begin(), c.end());
if(s > c[0]) {
//on je out ostali su in
for(auto e : c) {
if(e <= t)
return e;
}
return c[0];
} else {
//on je in ostali su out
for(auto e : c) {
if(e >= t)
return e;
}
return c.back();
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1968 ms |
2097156 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
512 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1364 ms |
2097156 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1107 ms |
500 KB |
Output is correct |
2 |
Runtime error |
1091 ms |
2097156 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1152 ms |
2097156 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |