답안 #432678

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
432678 2021-06-18T12:20:37 Z Ruba_K 기지국 (IOI20_stations) C++14
0 / 100
2807 ms 2097156 KB
#include "stations.h"
#include <vector>
#include<bits/stdc++.h>
using namespace std ;

int zft ;
const int N = 1e3 + 3 ;
vector<int> labels;
vector<int> adj[N];
void zftquestion(int u , int p  ){

    labels[u] = ++zft ;

    for(auto f : adj[u]){
        if(f != p)
            zftquestion(f , u);

    }


}
vector<int> label(int n, int k, vector<int> u, vector<int> v) {

    labels.resize(n);
	 for(int i = 0 ; i < n - 1 ; i ++)
        adj[u[i]].push_back(v[i]) , adj[v[i]].push_back(u[i]);

     int st ;

     for(int i = 0 ; i < n ; i ++)
        if(adj[i].size() == 1)st = i ;

	zftquestion(st , -1);
	return labels;
}

int find_next_station(int s, int t,vector<int> c) {
    
    if(c.size() == 1)return c[0];

    if(s < t)return c[1];


	return c[0];
}

Compilation message

stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:30:6: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   30 |      for(int i = 0 ; i < n ; i ++)
      |      ^~~
stations.cpp:33:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   33 |  zftquestion(st , -1);
      |  ^~~~~~~~~~~
stations.cpp:33:13: warning: 'st' may be used uninitialized in this function [-Wmaybe-uninitialized]
   33 |  zftquestion(st , -1);
      |  ~~~~~~~~~~~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 444 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 560 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1646 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 428 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2807 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -