제출 #605374

#제출 시각아이디문제언어결과실행 시간메모리
605374MohamedAliSaidane기지국 (IOI20_stations)C++14
8 / 100
945 ms548 KiB
#include <bits/stdc++.h>

    using namespace std;

    typedef long long ll;

    typedef pair<int,int> pii;
    typedef pair<ll,ll> pll;

    typedef vector<int> vi;
    typedef vector<ll> vll;
    typedef vector<pii> vpi;
    typedef vector<pll> vpl;

    #define pb push_back
    #define popb pop_back
    #define all(x) (x).begin(),(x).end()
    #define ff first
    #define ss second
    vi label(int n, int k, vi u, vi v)
    {
        vi rep;
        for(int i = 0; i < n; i++)
        {
            rep.pb(i);
        }
        return rep;
    }
    int find_next_station(int s, int t, vi c)
    {
        set<int> st;
        int cur = t;
        while(cur != 0)
        {
            st.insert(cur);
            if(cur & 1)
            {
                cur /= 2;
            }
            else
            {
                cur = cur/2 - 1;
            }
        }
        st.insert(cur);
        if(st.count(s) != 0)
        {
            if(st.count(( s + 1) * 2) != 0)
                return ((s + 1) * 2);
            else
                return s * 2 + 1;
        }
        else
        {
            if(s & 1)
                return s/2;
            else
                return s/2 - 1;
        }
    }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...