Submission #334652

# Submission time Handle Problem Language Result Execution time Memory
334652 2020-12-09T15:58:08 Z inwbear Stations (IOI20_stations) C++14
0 / 100
996 ms 1260 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,co[1005];
bitset<1005>go;
vector<int>v[1005];
void dfs(int N)
{
	go[N]=true;
	bool ed=true;
	co[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;
	}
	return;
}
vector<int>label(int n,int k,vector<int>a,vector<int>b)
{
	vector<int>labels(n);
	rr=0,nn=0;
	for(int i=0;i<1005;i++)v[i].clear(),go[i]=false;
	for(int i=0;i<a.size();i++)
	{
		v[a[i]].pb(b[i]);
		v[b[i]].pb(a[i]);
	}
	dfs(0);
	for(int i=0;i<n;i++)labels[i]=co[i];
	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 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:43:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |  for(int i=0;i<a.size();i++)
      |              ~^~~~~~~~~
stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:69:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   69 |   for(int i=0;i<c.size();i++)
      |               ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 492 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=1005
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 396 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=2, label=256001
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 565 ms 1012 KB Output is correct
2 Correct 446 ms 864 KB Output is correct
3 Correct 996 ms 1040 KB Output is correct
4 Correct 683 ms 840 KB Output is correct
5 Correct 782 ms 864 KB Output is correct
6 Correct 483 ms 988 KB Output is correct
7 Correct 558 ms 1016 KB Output is correct
8 Correct 3 ms 948 KB Output is correct
9 Correct 5 ms 864 KB Output is correct
10 Correct 2 ms 736 KB Output is correct
11 Incorrect 597 ms 948 KB Wrong query response.
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 910 ms 948 KB Output is correct
2 Correct 649 ms 956 KB Output is correct
3 Correct 573 ms 736 KB Output is correct
4 Correct 3 ms 948 KB Output is correct
5 Correct 5 ms 776 KB Output is correct
6 Correct 2 ms 736 KB Output is correct
7 Incorrect 692 ms 736 KB Wrong query response.
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 598 ms 1260 KB Partially correct
2 Partially correct 468 ms 864 KB Partially correct
3 Correct 869 ms 948 KB Output is correct
4 Partially correct 722 ms 960 KB Partially correct
5 Partially correct 589 ms 992 KB Partially correct
6 Partially correct 470 ms 1108 KB Partially correct
7 Partially correct 527 ms 876 KB Partially correct
8 Partially correct 3 ms 864 KB Partially correct
9 Correct 4 ms 864 KB Output is correct
10 Partially correct 2 ms 736 KB Partially correct
11 Incorrect 490 ms 864 KB Wrong query response.
12 Halted 0 ms 0 KB -