# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
541599 | 2022-03-23T20:10:26 Z | Vladth11 | Stations (IOI20_stations) | C++14 | 729 ms | 664 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; int lvl[NMAX]; vector <int> g[NMAX]; int stamp; void DFS(int node, int p){ lvl[node] = lvl[p] + 1; if(lvl[node] % 2){ sol[node] = stamp++; } for(auto x : g[node]){ if(x == p) continue; DFS(x, node); } if(lvl[node] % 2 == 0) sol[node] = stamp++; } vector<int> label(int n, int k, vector<int> u, vector<int> v) { sol.clear(); sol.resize(n); stamp = 0; for(int i = 0; i < n; i++){ g[i].clear(); lvl[i] = 0; } 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()); if(s >= c[0]) reverse(c.begin(), c.end()); for(int i = 0; i < c.size(); i++){ if(c[i] > s && s <= t && t <= c[i]){ return c[i]; }else if(c[i] < s && c[i] <= t && t <= s){ return c[i]; } } if(s < c[0]){ /// s e pe preodine return c.back(); } return c[0]; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 416 ms | 548 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 397 ms | 548 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 469 ms | 572 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 729 ms | 416 KB | Output is correct |
2 | Correct | 592 ms | 416 KB | Output is correct |
3 | Incorrect | 516 ms | 416 KB | Wrong query response. |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 446 ms | 664 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |