답안 #955076

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
955076 2024-03-29T10:35:55 Z Trisanu_Das 기지국 (IOI20_stations) C++17
16 / 100
622 ms 1556 KB
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
vector<int> adj[1001], col;
int lab = 0;
void dfs(int s, int p, int lab){
	col[s]=lab;
	for(auto u : adj[s]) if(u!=p) dfs(u,s,lab+1);
}
 
vector<int> label(int n, int k, vector<int> a, vector<int> b)
{
    col.resize(n,0); lab = 0;
    for(int i = 0; i < n; i++) adj[i].clear();
	for (int i = 0; i < n-1; i++) adj[a[i]].pb(b[i]), adj[b[i]].pb(a[i]);
  	int ind = 0, x=1;
  	for(int i = 0; i < n; i++) if(adj[i].size()>=3) ind = i;
  	for(auto u : adj[ind]) dfs(u,ind,x*1000),x++; col[ind]=0; return col;
}
 
int fi(int x){ return x/1000; }
int find_next_station(int s, int t, vector<int> c){
	if(c.size()==1 or t==0) return c[0];
  	if(s==0) for(auto u : c) if(fi(u)==fi(t)) return u;
  	if(fi(s)!=fi(t)) return c[0];
  	return c[s<t];
}

Compilation message

stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:19:4: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   19 |    for(auto u : adj[ind]) dfs(u,ind,x*1000),x++; col[ind]=0; return col;
      |    ^~~
stations.cpp:19:50: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   19 |    for(auto u : adj[ind]) dfs(u,ind,x*1000),x++; col[ind]=0; return col;
      |                                                  ^~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 544 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=2004
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 532 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=0, label=1007
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 374 ms 896 KB Output is correct
2 Correct 301 ms 1556 KB Output is correct
3 Correct 524 ms 844 KB Output is correct
4 Correct 470 ms 684 KB Output is correct
5 Correct 391 ms 680 KB Output is correct
6 Correct 294 ms 880 KB Output is correct
7 Correct 282 ms 684 KB Output is correct
8 Correct 1 ms 764 KB Output is correct
9 Correct 3 ms 768 KB Output is correct
10 Correct 1 ms 768 KB Output is correct
11 Correct 389 ms 688 KB Output is correct
12 Correct 315 ms 1136 KB Output is correct
13 Correct 310 ms 1396 KB Output is correct
14 Correct 282 ms 684 KB Output is correct
15 Correct 28 ms 764 KB Output is correct
16 Correct 37 ms 896 KB Output is correct
17 Correct 63 ms 908 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 550 ms 684 KB Output is correct
2 Correct 459 ms 684 KB Output is correct
3 Correct 387 ms 684 KB Output is correct
4 Correct 1 ms 764 KB Output is correct
5 Correct 3 ms 768 KB Output is correct
6 Correct 1 ms 1160 KB Output is correct
7 Correct 396 ms 684 KB Output is correct
8 Correct 622 ms 684 KB Output is correct
9 Correct 377 ms 940 KB Output is correct
10 Correct 387 ms 684 KB Output is correct
11 Incorrect 1 ms 344 KB Invalid labels (duplicates values). scenario=5, label=1001
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 334 ms 888 KB Partially correct
2 Partially correct 298 ms 1144 KB Partially correct
3 Correct 576 ms 684 KB Output is correct
4 Partially correct 447 ms 684 KB Partially correct
5 Partially correct 358 ms 684 KB Partially correct
6 Partially correct 293 ms 884 KB Partially correct
7 Partially correct 267 ms 684 KB Partially correct
8 Partially correct 1 ms 764 KB Partially correct
9 Partially correct 2 ms 768 KB Partially correct
10 Partially correct 1 ms 768 KB Partially correct
11 Incorrect 3 ms 532 KB Invalid labels (duplicates values). scenario=0, label=1009
12 Halted 0 ms 0 KB -