# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
307441 |
2020-09-28T06:15:52 Z |
syy |
Stations (IOI20_stations) |
C++17 |
|
1008 ms |
1160 KB |
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define FOR(i, a, b) for(int i = (int)a; i <= (int)b; i++)
#define DEC(i, a, b) for(int i = (int)a; i >= (int)b; i--)
typedef pair<int, int> pi;
typedef pair<pi, int> pii;
typedef pair<pi, pi> pipi;
#define f first
#define s second
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef vector<pii> vpii;
#define pb push_back
#define pf push_front
#define all(v) v.begin(), v.end()
#define disc(v) sort(all(v)); v.resize(unique(all(v)) - v.begin());
#define INF (int) 1e9 + 100
#define LLINF (ll) 1e18
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define sandybridge __attribute__((optimize("Ofast"), target("arch=sandybridge")))
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); //can be used by calling rng() or shuffle(A, A+n, rng)
inline ll rand(ll x, ll y) { ++y; return (rng() % (y-x)) + x; } //inclusivesss
int n;
vi adj[1005], res;
void dfs(int x, int p, int c) {
res[x] = c;
for (auto it:adj[x]) if (it != p) dfs(it, x, c+1);
}
vector<int> label(int N, int k, vector<int> u, vector<int> v) {
n = N; res.clear(); res.resize(n);
FOR(i, 0, n-1) adj[i].clear();
FOR(i, 0, n-2) adj[u[i]].pb(v[i]), adj[v[i]].pb(u[i]);
int st = 0; FOR(i, 0, n-1) if (adj[i].size() == 1) st = i;
dfs(st, -1, 0);
return res;
}
int find_next_station(int s, int t, std::vector<int> c) {
return (t > s ? s+1 : s-1);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
536 ms |
1016 KB |
Output is correct |
2 |
Correct |
459 ms |
768 KB |
Output is correct |
3 |
Correct |
878 ms |
1160 KB |
Output is correct |
4 |
Correct |
662 ms |
880 KB |
Output is correct |
5 |
Correct |
599 ms |
872 KB |
Output is correct |
6 |
Correct |
478 ms |
768 KB |
Output is correct |
7 |
Correct |
453 ms |
768 KB |
Output is correct |
8 |
Correct |
2 ms |
872 KB |
Output is correct |
9 |
Correct |
5 ms |
864 KB |
Output is correct |
10 |
Correct |
1 ms |
868 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
388 KB |
Invalid labels (duplicates values). scenario=0, label=11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
528 ms |
1024 KB |
Output is correct |
2 |
Correct |
443 ms |
1024 KB |
Output is correct |
3 |
Correct |
857 ms |
872 KB |
Output is correct |
4 |
Correct |
778 ms |
768 KB |
Output is correct |
5 |
Correct |
683 ms |
768 KB |
Output is correct |
6 |
Correct |
585 ms |
780 KB |
Output is correct |
7 |
Correct |
593 ms |
788 KB |
Output is correct |
8 |
Correct |
3 ms |
872 KB |
Output is correct |
9 |
Correct |
4 ms |
768 KB |
Output is correct |
10 |
Correct |
2 ms |
832 KB |
Output is correct |
11 |
Incorrect |
1 ms |
384 KB |
Invalid labels (duplicates values). scenario=1, label=2 |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1008 ms |
768 KB |
Output is correct |
2 |
Correct |
643 ms |
872 KB |
Output is correct |
3 |
Correct |
670 ms |
1024 KB |
Output is correct |
4 |
Correct |
3 ms |
872 KB |
Output is correct |
5 |
Correct |
4 ms |
768 KB |
Output is correct |
6 |
Correct |
1 ms |
768 KB |
Output is correct |
7 |
Incorrect |
1 ms |
400 KB |
Invalid labels (duplicates values). scenario=0, label=2 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
546 ms |
768 KB |
Output is correct |
2 |
Correct |
446 ms |
768 KB |
Output is correct |
3 |
Correct |
832 ms |
768 KB |
Output is correct |
4 |
Correct |
750 ms |
872 KB |
Output is correct |
5 |
Correct |
566 ms |
768 KB |
Output is correct |
6 |
Correct |
513 ms |
768 KB |
Output is correct |
7 |
Correct |
444 ms |
768 KB |
Output is correct |
8 |
Correct |
3 ms |
872 KB |
Output is correct |
9 |
Correct |
5 ms |
876 KB |
Output is correct |
10 |
Correct |
2 ms |
768 KB |
Output is correct |
11 |
Incorrect |
5 ms |
384 KB |
Invalid labels (duplicates values). scenario=0, label=11 |
12 |
Halted |
0 ms |
0 KB |
- |