답안 #606160

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
606160 2022-07-26T05:20:23 Z polya 기지국 (IOI20_stations) C++14
5 / 100
985 ms 712 KB
#pragma GCC optimize("O0")
#include "stations.h"
 
using namespace std;
 
vector<int> adj[1004];
vector<int> labels;
int cnt = 0;
 
int dfs(int nn) {
    if (labels[nn] != 10000) return 0;
	labels[nn] = cnt++;
	for (auto &ii : adj[nn]) dfs(ii);
  return 0;
}
 
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
  for (int i=0; i<n; i++) adj[i].clear(); labels.clear(); cnt = 0;
	labels.resize(n, 10000);
	for (int i=0; i<n-1; i++) {
		adj[u[i]].emplace_back(v[i]);
      adj[v[i]].emplace_back(u[i]);
	}
	for (int i=0; i<n; i++) {
		if (adj[i].size() == 1) { dfs(i); return labels;}
	}
    return labels;
}
 
int find_next_station(int s, int t, std::vector<int> c) {
	if (s < t) return s+1;
	else return s-1;
}

Compilation message

stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:18:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   18 |   for (int i=0; i<n; i++) adj[i].clear(); labels.clear(); cnt = 0;
      |   ^~~
stations.cpp:18:43: 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++) adj[i].clear(); labels.clear(); cnt = 0;
      |                                           ^~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 572 ms 548 KB Output is correct
2 Correct 555 ms 712 KB Output is correct
3 Correct 890 ms 500 KB Output is correct
4 Correct 563 ms 516 KB Output is correct
5 Correct 630 ms 420 KB Output is correct
6 Correct 428 ms 580 KB Output is correct
7 Correct 493 ms 644 KB Output is correct
8 Correct 2 ms 564 KB Output is correct
9 Correct 3 ms 492 KB Output is correct
10 Correct 1 ms 492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 508 ms 544 KB Wrong query response.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 594 ms 656 KB Output is correct
2 Correct 506 ms 648 KB Output is correct
3 Correct 951 ms 464 KB Output is correct
4 Correct 687 ms 420 KB Output is correct
5 Correct 571 ms 420 KB Output is correct
6 Correct 435 ms 548 KB Output is correct
7 Correct 523 ms 548 KB Output is correct
8 Correct 1 ms 492 KB Output is correct
9 Correct 2 ms 492 KB Output is correct
10 Correct 0 ms 492 KB Output is correct
11 Incorrect 594 ms 520 KB Wrong query response.
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 985 ms 516 KB Output is correct
2 Correct 749 ms 516 KB Output is correct
3 Correct 688 ms 516 KB Output is correct
4 Correct 1 ms 492 KB Output is correct
5 Correct 3 ms 488 KB Output is correct
6 Correct 1 ms 496 KB Output is correct
7 Incorrect 608 ms 516 KB Wrong query response.
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 580 ms 544 KB Output is correct
2 Correct 480 ms 608 KB Output is correct
3 Correct 770 ms 416 KB Output is correct
4 Correct 680 ms 484 KB Output is correct
5 Correct 497 ms 520 KB Output is correct
6 Correct 487 ms 544 KB Output is correct
7 Correct 509 ms 644 KB Output is correct
8 Correct 1 ms 492 KB Output is correct
9 Correct 4 ms 492 KB Output is correct
10 Correct 2 ms 488 KB Output is correct
11 Incorrect 449 ms 524 KB Wrong query response.
12 Halted 0 ms 0 KB -