답안 #1095714

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1095714 2024-10-03T03:12:22 Z Newtonabc 기지국 (IOI20_stations) C++14
5 / 100
629 ms 832 KB
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
const int N=1e3+10;
int tmpcase1,cnt=0;
bool case1;
vector<int> adj[N],lb;
void labelcase1(int u,int p){
	lb[u]=cnt++;
	for(int i=0;i<adj[u].size();i++){
		if(adj[u][i]!=p) labelcase1(adj[u][i],u);
	}
}
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
	lb.resize(n);
	cnt=0;
	case1=true;
	for(int i=0;i<n-1;i++){
		adj[u[i]].push_back(v[i]);
		adj[v[i]].push_back(u[i]);
	}
	for(int i=0;i<n;i++){
		if(adj[i].size()>2) case1=false;
		if(adj[i].size()==1) tmpcase1=i;
	}
	if(case1){
		labelcase1(tmpcase1,-1);
	}
	for(int i=0;i<n;i++) adj[i].clear();
	/*for(int i=0;i<lb.size();i++) cout<<lb[i] <<" ";
	cout<<"\n\n\n";*/
	return lb;
}

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

Compilation message

stations.cpp: In function 'void labelcase1(int, int)':
stations.cpp:10:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |  for(int i=0;i<adj[u].size();i++){
      |              ~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 370 ms 684 KB Output is correct
2 Correct 325 ms 684 KB Output is correct
3 Correct 629 ms 684 KB Output is correct
4 Correct 457 ms 684 KB Output is correct
5 Correct 410 ms 684 KB Output is correct
6 Correct 301 ms 684 KB Output is correct
7 Correct 313 ms 684 KB Output is correct
8 Correct 1 ms 764 KB Output is correct
9 Correct 1 ms 776 KB Output is correct
10 Correct 1 ms 776 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 344 KB Invalid labels (duplicates values). scenario=0, label=0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 374 ms 684 KB Output is correct
2 Correct 283 ms 684 KB Output is correct
3 Correct 544 ms 684 KB Output is correct
4 Correct 486 ms 684 KB Output is correct
5 Correct 390 ms 684 KB Output is correct
6 Correct 329 ms 684 KB Output is correct
7 Correct 291 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 780 KB Output is correct
11 Incorrect 431 ms 684 KB Wrong query response.
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 595 ms 684 KB Output is correct
2 Correct 417 ms 684 KB Output is correct
3 Correct 406 ms 684 KB Output is correct
4 Correct 1 ms 768 KB Output is correct
5 Correct 1 ms 768 KB Output is correct
6 Correct 1 ms 768 KB Output is correct
7 Incorrect 0 ms 344 KB Invalid labels (duplicates values). scenario=0, label=0
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 372 ms 684 KB Output is correct
2 Correct 315 ms 684 KB Output is correct
3 Correct 610 ms 684 KB Output is correct
4 Correct 435 ms 684 KB Output is correct
5 Correct 380 ms 684 KB Output is correct
6 Correct 306 ms 684 KB Output is correct
7 Correct 273 ms 684 KB Output is correct
8 Correct 1 ms 768 KB Output is correct
9 Correct 1 ms 832 KB Output is correct
10 Correct 0 ms 776 KB Output is correct
11 Incorrect 2 ms 344 KB Invalid labels (duplicates values). scenario=0, label=0
12 Halted 0 ms 0 KB -