답안 #413207

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
413207 2021-05-28T11:10:59 Z losmi247 기지국 (IOI20_stations) C++14
0 / 100
1206 ms 656 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1005;

int deg[N];
vector <int> g[N];



vector <int> label(int n,int k,vector <int> u,vector <int> v){
    for(int i = 0; i < n; i++){
        deg[i] = 0;
        g[i].clear();
    }

    for(int i = 0; i < n-1; i++){
        deg[u[i]]++, deg[v[i]]++;
        g[u[i]].push_back(v[i]);
        g[v[i]].push_back(u[i]);
    }


    bool prvi = 1;
    for(int i = 0; i < n; i++) if(deg[i] > 2) prvi = 0;
    if(prvi){
        int cnt = 0;
        vector <int> l(n);
        queue <pair<int,int>> q;
        for(int i = 0; i < n; i++){
            if(deg[i] == 1){
                q.push({i,0});
                break;
            }
        }
        while(!q.empty()){
            int u = q.front().first,par = q.front().second;
            l[u] = cnt++;
            q.pop();
            for(auto v : g[u]){
                if(v == par) continue;
                q.push({v,u});
            }
        }
        return l;
    }
    assert(1 == 0);
}

int find_next_station(int s,int t,vector <int> c){
    if(s < t){
        return s+1;
    }
    else{
        return s-1;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 654 ms 552 KB Output is correct
2 Correct 537 ms 512 KB Output is correct
3 Correct 1008 ms 400 KB Output is correct
4 Incorrect 2 ms 308 KB Invalid labels (duplicates values). scenario=4, label=0
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 568 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 618 ms 528 KB Output is correct
2 Correct 487 ms 656 KB Output is correct
3 Correct 1039 ms 520 KB Output is correct
4 Incorrect 1 ms 200 KB Invalid labels (duplicates values). scenario=0, label=0
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1023 ms 400 KB Output is correct
2 Incorrect 1 ms 200 KB Invalid labels (duplicates values). scenario=1, label=0
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 667 ms 576 KB Output is correct
2 Correct 563 ms 512 KB Output is correct
3 Correct 1206 ms 400 KB Output is correct
4 Incorrect 1 ms 316 KB Invalid labels (duplicates values). scenario=0, label=0
5 Halted 0 ms 0 KB -