답안 #334626

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
334626 2020-12-09T15:18:38 Z inwbear 기지국 (IOI20_stations) C++14
0 / 100
1 ms 492 KB
#include "stations.h"
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define MEM(x,a) memset((x),a,sizeof((x)))
#define F first
#define S second
#define imx INT_MAX
const long long MOD = (long long)(1e9+7);
const long long MMX = (long long)(1e18);
typedef long long LL;
typedef pair<int,int> pii;
int rr,nn;
bitset<1005>go;
vector<int>v[1005],labels;
void dfs(int N)
{
	go[N]=true;
	bool ed=true;
	labels[N]=(rr*1000)+nn;
	for(int i=0;i<v[N].size();i++)
	{
		if(!go[v[N][i]])
		{
			ed=false;
			nn++;
			dfs(v[N][i]);
		}
	}
	if(ed)
	{
		rr++;
		nn=0;
	}
}
vector<int>label(int n,int k,vector<int>a,vector<int>b)
{
	for(int i=0;i<n;i++)labels.pb(0);
	for(int i=0;i<n-1;i++)
	{
		v[a[i]].pb(b[i]);
		v[b[i]].pb(a[i]);
	}
	dfs(0);
	return labels;
}

int find_next_station(int s,int t,vector<int>c)
{
	int re=-1;
	if(s/1000==t/1000)
	{
		if(s>t)
		{
			re=s-1;
		}
		else
		{
			re=s+1;
		}
	}
	else
	{
		for(int i=0;i<c.size();i++)
		{
			if(t/1000==c[i]/1000)
			{
				re=c[i];
			}
		}
	}
	if(re==-1)return s-1;
	else return re;
}

Compilation message

stations.cpp: In function 'void dfs(int)':
stations.cpp:22:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |  for(int i=0;i<v[N].size();i++)
      |              ~^~~~~~~~~~~~
stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:65:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   65 |   for(int i=0;i<c.size();i++)
      |               ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 492 KB Invalid length of array as the response of 'label'. scenario=1, n=3, len=13
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB Invalid length of array as the response of 'label'. scenario=1, n=994, len=1990
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB Invalid length of array as the response of 'label'. scenario=1, n=997, len=999
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB Invalid length of array as the response of 'label'. scenario=1, n=2, len=4
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB Invalid length of array as the response of 'label'. scenario=1, n=998, len=1001
2 Halted 0 ms 0 KB -