답안 #350005

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
350005 2021-01-18T20:30:52 Z Osama_Alkhodairy 기지국 (IOI20_stations) C++17
5 / 100
1200 ms 1240 KB
#include <bits/stdc++.h>
#include "stations.h"
//~ #include "stub.cpp"
using namespace std;

const int N = 1001;

int st[N], en[N], dep[N], dfstime;
vector <int> g[N];

void dfs(int node, int pnode){
    if(dep[node] % 2) st[node] = dfstime++;
    for(auto &i : g[node]){
        if(i == pnode) continue;
        dep[i] = dep[node] + 1;
        dfs(i, node);
    }
    if(dep[node] % 2 == 0) en[node] = dfstime++;
}
vector<int> label(int n, int k, vector<int> u, std::vector<int> v) {
    dfstime = 0;
    for(int i = 0 ; i < n ; i++){
        g[i].clear();
    }
    for(int i = 0 ; i < (int)u.size() ; i++){
        g[u[i]].push_back(v[i]);
        g[v[i]].push_back(u[i]);
    }
    dfs(0, -1);
    vector <int> ret(n);
    for(int i = 0 ; i < n ; i++){
        if(dep[i] % 2) ret[i] = st[i];
        else ret[i] = en[i];
    }
    return ret;
}
int find_next_station(int s, int t, vector<int> c) {
	if(c.size() == 1) return c[0];
    sort(c.begin(), c.end());
    if(c.back() > s){
        int p = c.back();
        c.pop_back();
        c.insert(c.begin(), s);
        for(int i = 0 ; i + 1 < (int)c.size() ; i++){
            if(c[i] <= t && t <= c[i + 1]){
                return c[i + 1];
            }
        }
        return p;
    }
    else{
        int p = c[0];
        c.erase(c.begin());
        c.push_back(s);
        for(int i = 0 ; i + 1 < (int)c.size() ; i++){
            if(c[i] <= t && t <= c[i + 1]){
                return c[i];
            }
        }
        return p;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 611 ms 1212 KB Output is correct
2 Correct 525 ms 1080 KB Output is correct
3 Correct 1148 ms 716 KB Output is correct
4 Correct 719 ms 940 KB Output is correct
5 Correct 733 ms 940 KB Output is correct
6 Correct 514 ms 992 KB Output is correct
7 Correct 524 ms 1108 KB Output is correct
8 Correct 3 ms 940 KB Output is correct
9 Correct 4 ms 992 KB Output is correct
10 Correct 1 ms 864 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 492 ms 1120 KB Wrong query response.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 568 ms 1080 KB Output is correct
2 Correct 551 ms 1144 KB Output is correct
3 Correct 993 ms 940 KB Output is correct
4 Correct 746 ms 736 KB Output is correct
5 Correct 704 ms 864 KB Output is correct
6 Correct 634 ms 1084 KB Output is correct
7 Correct 557 ms 1112 KB Output is correct
8 Correct 2 ms 736 KB Output is correct
9 Correct 5 ms 940 KB Output is correct
10 Correct 1 ms 736 KB Output is correct
11 Incorrect 711 ms 864 KB Wrong query response.
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1055 ms 1044 KB Output is correct
2 Correct 822 ms 832 KB Output is correct
3 Correct 676 ms 940 KB Output is correct
4 Correct 3 ms 864 KB Output is correct
5 Correct 4 ms 940 KB Output is correct
6 Correct 1 ms 736 KB Output is correct
7 Correct 719 ms 736 KB Output is correct
8 Correct 1200 ms 908 KB Output is correct
9 Correct 736 ms 940 KB Output is correct
10 Correct 651 ms 1240 KB Output is correct
11 Incorrect 6 ms 736 KB Wrong query response.
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 532 ms 864 KB Output is correct
2 Correct 586 ms 864 KB Output is correct
3 Correct 953 ms 1100 KB Output is correct
4 Correct 827 ms 864 KB Output is correct
5 Correct 642 ms 940 KB Output is correct
6 Correct 529 ms 1084 KB Output is correct
7 Correct 543 ms 872 KB Output is correct
8 Correct 3 ms 904 KB Output is correct
9 Correct 4 ms 736 KB Output is correct
10 Correct 2 ms 948 KB Output is correct
11 Incorrect 524 ms 880 KB Wrong query response.
12 Halted 0 ms 0 KB -