Submission #687644

# Submission time Handle Problem Language Result Execution time Memory
687644 2023-01-26T17:52:32 Z urosk Stations (IOI20_stations) C++14
52.3205 / 100
905 ms 764 KB
#include "stations.h"
#define here cerr<<"===========================================\n"
#define dbg(x) cerr<<#x<<": "<<x<<endl;
#include "bits/stdc++.h"
#define ld double
#define ll int
#define llinf 100000000000000000LL // 10^17
#define pb push_back
#define popb pop_back
#define fi first
#define sc second
#define endl '\n'
#define pll pair<ll,ll>
#define pld pair<ld,ld>
#define sz(a) (ll)(a.size())
#define all(a) a.begin(),a.end()
#define ceri(a,l,r) {cerr<<#a<<": ";for(ll i_ = l;i_<=r;i_++) cerr<<a[i_]<< " ";cerr<<endl;}
#define cer(a) {cerr<<#a<<": ";for(ll x_ : a) cerr<<x_<< " ";cerr<<endl;}

using namespace std;

#define maxn 1005
vector<ll> label(ll N, ll K,vector<ll> u,vector<ll> v){
    ll n = N;
    vector<vector<ll> > g(n);
    vector<ll> in(n),out(n),par(n);
    ll ti = 0;
    for(ll i = 0;i<n-1;i++){
        ll x = u[i],y = v[i];
        g[x].pb(y);
        g[y].pb(x);
    }
    function<void(ll,ll)> dfs = [&](ll u,ll p)
	{
        in[u] = ti++;
        for(ll s : g[u]) if(s!=p) dfs(s,u);
        out[u] = ti-1;
	};
	dfs(0,0);
    vector<ll> ans(n);
    for(ll i = 0;i<n;i++) ans[i] = in[i]*1000+out[i];
	return ans;
}
bool intree(ll v,ll u){
    ll inu = u/1000,outu = u%1000;
    ll inv = v/1000,outv = v%1000;
    return inu<=inv&&outu>=outv;
}
ll find_next_station(ll u, ll v, vector<ll> w){
    ll p = -1;
    for(ll s : w){
        if(intree(u,s)) p = s;
    }
    for(ll s : w){
        if(s==p) continue;
        if(intree(v,s)) return s;
    }
	return p;
}
/**
1
5 1000000000
0 1
1 2
1 3
2 4
2
2 0 0
1 3 0
**/
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 424 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=6009
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 328 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=1511
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 465 ms 692 KB Output is correct
2 Correct 469 ms 676 KB Output is correct
3 Correct 830 ms 492 KB Output is correct
4 Correct 686 ms 504 KB Output is correct
5 Correct 510 ms 480 KB Output is correct
6 Correct 456 ms 664 KB Output is correct
7 Correct 381 ms 628 KB Output is correct
8 Correct 2 ms 500 KB Output is correct
9 Correct 4 ms 492 KB Output is correct
10 Correct 1 ms 492 KB Output is correct
11 Correct 528 ms 416 KB Output is correct
12 Correct 440 ms 764 KB Output is correct
13 Correct 437 ms 716 KB Output is correct
14 Correct 457 ms 508 KB Output is correct
15 Correct 49 ms 468 KB Output is correct
16 Correct 63 ms 616 KB Output is correct
17 Correct 102 ms 532 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 806 ms 488 KB Output is correct
2 Correct 595 ms 420 KB Output is correct
3 Correct 612 ms 420 KB Output is correct
4 Correct 3 ms 492 KB Output is correct
5 Correct 4 ms 492 KB Output is correct
6 Correct 1 ms 492 KB Output is correct
7 Correct 585 ms 420 KB Output is correct
8 Correct 866 ms 420 KB Output is correct
9 Correct 638 ms 416 KB Output is correct
10 Correct 509 ms 416 KB Output is correct
11 Correct 4 ms 492 KB Output is correct
12 Correct 5 ms 588 KB Output is correct
13 Correct 3 ms 492 KB Output is correct
14 Correct 2 ms 504 KB Output is correct
15 Correct 2 ms 496 KB Output is correct
16 Correct 452 ms 420 KB Output is correct
17 Correct 482 ms 416 KB Output is correct
18 Correct 451 ms 416 KB Output is correct
19 Correct 512 ms 500 KB Output is correct
20 Correct 365 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 537 ms 728 KB Partially correct
2 Partially correct 429 ms 672 KB Partially correct
3 Partially correct 905 ms 616 KB Partially correct
4 Partially correct 689 ms 504 KB Partially correct
5 Partially correct 582 ms 500 KB Partially correct
6 Partially correct 401 ms 636 KB Partially correct
7 Partially correct 433 ms 624 KB Partially correct
8 Partially correct 2 ms 492 KB Partially correct
9 Partially correct 3 ms 492 KB Partially correct
10 Partially correct 1 ms 492 KB Partially correct
11 Partially correct 421 ms 480 KB Partially correct
12 Partially correct 499 ms 548 KB Partially correct
13 Partially correct 878 ms 520 KB Partially correct
14 Partially correct 604 ms 416 KB Partially correct
15 Partially correct 545 ms 416 KB Partially correct
16 Partially correct 470 ms 500 KB Partially correct
17 Partially correct 585 ms 508 KB Partially correct
18 Partially correct 574 ms 716 KB Partially correct
19 Partially correct 338 ms 704 KB Partially correct
20 Partially correct 517 ms 504 KB Partially correct
21 Partially correct 79 ms 504 KB Partially correct
22 Partially correct 77 ms 656 KB Partially correct
23 Partially correct 157 ms 612 KB Partially correct
24 Partially correct 9 ms 492 KB Partially correct
25 Partially correct 6 ms 564 KB Partially correct
26 Partially correct 4 ms 492 KB Partially correct
27 Partially correct 4 ms 568 KB Partially correct
28 Partially correct 2 ms 492 KB Partially correct
29 Partially correct 612 ms 556 KB Partially correct
30 Partially correct 469 ms 524 KB Partially correct
31 Partially correct 522 ms 572 KB Partially correct
32 Partially correct 507 ms 512 KB Partially correct
33 Partially correct 512 ms 500 KB Partially correct
34 Partially correct 314 ms 664 KB Partially correct
35 Partially correct 510 ms 664 KB Partially correct
36 Partially correct 483 ms 672 KB Partially correct
37 Partially correct 448 ms 612 KB Partially correct
38 Partially correct 457 ms 584 KB Partially correct
39 Partially correct 486 ms 704 KB Partially correct
40 Partially correct 441 ms 616 KB Partially correct
41 Partially correct 442 ms 732 KB Partially correct
42 Partially correct 64 ms 544 KB Partially correct
43 Partially correct 118 ms 572 KB Partially correct
44 Partially correct 113 ms 592 KB Partially correct
45 Partially correct 126 ms 512 KB Partially correct
46 Partially correct 305 ms 548 KB Partially correct
47 Partially correct 240 ms 632 KB Partially correct
48 Partially correct 64 ms 668 KB Partially correct
49 Partially correct 63 ms 668 KB Partially correct