답안 #839199

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
839199 2023-08-29T03:52:10 Z hackerbhaiya 기지국 (IOI20_stations) C++14
0 / 100
639 ms 572 KB
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// template<class T> using Tree = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization("unroll-loops")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC optimize("fast-math")
// #pragma GCC optimize("no-stack-protector")
// #define ll __int128
// #define ll long long
#define ll int
#define f(i,a,b) for(ll i=a;i<b;i++)
#define mod 1000000007
// #define mod 998244353 
#define mp make_pair
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define ff first
#define ss second
#define rf(i,a,b) for(ll i=a;i>=b;i--)
#define sc(a) scanf("%lld",&a)
#define pf printf
#define sz(a) (int)(a.size())
#define psf push_front
#define ppf pop_front
#define ppb pop_back
#define pb push_back
#define pq priority_queue
#define all(s) s.begin(),s.end()
#define sp(a) setprecision(a)
#define rz resize
#define ld long double
#define inf (ll)1e9
#define ub upper_bound
#define lb lower_bound
#define bs binary_search
#define eb emplace_back
const double pi = acos(-1);
ll binpow(ll a, ll b){ll res=1;while(b!=0){if(b&1)res*=a;a*=a;b>>=1;}return res;}
ll binpow(ll a, ll b, ll md){ll res=1;a%=md;if(a==0)return 0;while(b!=0){if(b&1)res*=a,res%=md;a*=a,a%=md;b>>=1;}return res%md;}
 
using namespace std;

void dfs(ll cur, ll par, ll &t, vector<ll> &out, vector<vector<ll> > &v)
{
    f(i,0,sz(v[cur]))
    {
        ll node=v[cur][i];
        if(node!=par)
            dfs(node,cur,t,out,v);
    }
    out[cur]=t++;
}

vector<ll> label(ll n, ll k, vector<ll> u, vector<ll> v)
{
    vector<vector<ll> > gra(n);
    vector<ll> out(n);
    ll t=0;
    f(i,0,n-1)
    {
        ll l=u[i],r=v[i];
        gra[l].pb(r),gra[r].pb(l);
    }

    dfs(0,0,t,out,gra);

    return out;
}

ll find_next_station(ll s, ll t, vector<ll> out)
{
    ll mx=0;
    f(i,0,sz(out))
    {
        if(out[i]>=t)
            return out[i];
        mx=max(mx,out[i]);
    }

    return mx;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 384 ms 548 KB Wrong query response.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 325 ms 508 KB Wrong query response.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 390 ms 548 KB Wrong query response.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 639 ms 572 KB Output is correct
2 Correct 448 ms 544 KB Output is correct
3 Incorrect 423 ms 420 KB Wrong query response.
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 387 ms 548 KB Wrong query response.
2 Halted 0 ms 0 KB -