Submission #305333

# Submission time Handle Problem Language Result Execution time Memory
305333 2020-09-23T00:38:56 Z daniel920712 Stations (IOI20_stations) C++14
0 / 100
2 ms 448 KB
#include "stations.h"
#include <vector>
using namespace std;
vector < int > Next[1005];
int con[1005]={0};
bool use[1005]={0};
vector<int> labels;
void F(int here,int con)
{
    labels[here]=con;
    use[here]=1;
    for(auto i:Next[here])
    {
        if(!use[i]) F(i,con+1);
    }
}

vector<int> label(int n, int k, vector<int> u, vector<int> v)
{
    int i;
	for(i=0;i<n;i++) labels.push_back(0);
	for(int i=1;i<n;i++)
    {
        con[u[i]]++;
        con[v[i]]++;
        Next[u[i]].push_back(v[i]);
        Next[v[i]].push_back(u[i]);
    }
	for(i=0;i<n;i++)
    {
        if(con[i]==1)
        {
            F(i,0);
            break;
        }
    }
	return labels;
}

int find_next_station(int s, int t, vector<int> c)
{
    if(s<t) return s+1;
    else return s-1;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 392 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 448 KB Invalid length of array as the response of 'label'. scenario=1, n=994, len=1990
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Invalid length of array as the response of 'label'. scenario=1, n=997, len=999
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 384 KB Invalid length of array as the response of 'label'. scenario=1, n=2, len=4
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 388 KB Invalid length of array as the response of 'label'. scenario=1, n=998, len=1001
2 Halted 0 ms 0 KB -