답안 #307120

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
307120 2020-09-27T06:47:56 Z dxz05 기지국 (IOI20_stations) C++14
5 / 100
1029 ms 1140 KB
#include "stations.h"
#include <bits/stdc++.h>

using namespace std;

const int MAXN = 1111;

vector<int> g[MAXN];
vector<int> vec;
void dfs(int v, int p){
    vec.push_back(v);
    for (int u : g[v]){
        if (u != p) dfs(u, v);
    }
}

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

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

	int idx = 0;
	for (int i = 0; i < n; i++){
        if (g[i].size() == 1) idx = i;
	}

	dfs(idx, -1);
	for (int i = 0; i < n; i++){
        labels[vec[i]] = i;
	}
	return labels;
}

int find_next_station(int s, int t, vector<int> c) {
	return (s < t ? s + 1 : s - 1);
}

Compilation message

stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:18:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   18 |     for (int i = 0; i < n; i++) g[i].clear(); vec.clear();
      |     ^~~
stations.cpp:18:47: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   18 |     for (int i = 0; i < n; i++) g[i].clear(); vec.clear();
      |                                               ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 544 ms 1024 KB Output is correct
2 Correct 448 ms 768 KB Output is correct
3 Correct 893 ms 876 KB Output is correct
4 Correct 617 ms 884 KB Output is correct
5 Correct 674 ms 1140 KB Output is correct
6 Correct 479 ms 788 KB Output is correct
7 Correct 524 ms 788 KB Output is correct
8 Correct 3 ms 876 KB Output is correct
9 Correct 3 ms 768 KB Output is correct
10 Correct 1 ms 768 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 510 ms 816 KB Wrong query response.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 644 ms 1008 KB Output is correct
2 Correct 494 ms 900 KB Output is correct
3 Correct 884 ms 872 KB Output is correct
4 Correct 646 ms 768 KB Output is correct
5 Correct 675 ms 876 KB Output is correct
6 Correct 471 ms 768 KB Output is correct
7 Correct 569 ms 768 KB Output is correct
8 Correct 3 ms 768 KB Output is correct
9 Correct 5 ms 768 KB Output is correct
10 Correct 2 ms 768 KB Output is correct
11 Incorrect 669 ms 768 KB Wrong query response.
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1029 ms 880 KB Output is correct
2 Correct 717 ms 896 KB Output is correct
3 Correct 660 ms 1004 KB Output is correct
4 Correct 2 ms 1012 KB Output is correct
5 Correct 5 ms 888 KB Output is correct
6 Correct 1 ms 768 KB Output is correct
7 Incorrect 610 ms 768 KB Wrong query response.
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 528 ms 768 KB Output is correct
2 Correct 435 ms 776 KB Output is correct
3 Correct 913 ms 872 KB Output is correct
4 Correct 660 ms 768 KB Output is correct
5 Correct 630 ms 1040 KB Output is correct
6 Correct 608 ms 768 KB Output is correct
7 Correct 459 ms 768 KB Output is correct
8 Correct 3 ms 768 KB Output is correct
9 Correct 4 ms 768 KB Output is correct
10 Correct 0 ms 768 KB Output is correct
11 Incorrect 484 ms 768 KB Wrong query response.
12 Halted 0 ms 0 KB -