Submission #305337

# Submission time Handle Problem Language Result Execution time Memory
305337 2020-09-23T00:47:32 Z daniel920712 Stations (IOI20_stations) C++14
5 / 100
919 ms 1024 KB
#include "stations.h"
#include <vector>
using namespace std;
vector < int > Next[1005];
int con[1005]={0};
int ans[1005]={0};
bool use[1005]={0};

void F(int here,int con)
{
    ans[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)
{
    vector<int> labels;
    int i;
	for(i=0;i<n;i++)
    {
        labels.push_back(0);
        Next[i].clear();
        con[i]=0;
        use[i]=0;
    }
	for(int i=0;i<n-1;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;
        }
    }
    for(i=0;i<n;i++) labels[i]=ans[i];
	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 Correct 527 ms 808 KB Output is correct
2 Correct 426 ms 792 KB Output is correct
3 Correct 919 ms 1024 KB Output is correct
4 Correct 766 ms 768 KB Output is correct
5 Correct 717 ms 768 KB Output is correct
6 Correct 522 ms 800 KB Output is correct
7 Correct 448 ms 804 KB Output is correct
8 Correct 2 ms 880 KB Output is correct
9 Correct 3 ms 768 KB Output is correct
10 Correct 0 ms 768 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 384 KB Invalid labels (duplicates values). scenario=0, label=10
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 567 ms 768 KB Output is correct
2 Correct 511 ms 896 KB Output is correct
3 Correct 853 ms 880 KB Output is correct
4 Correct 650 ms 916 KB Output is correct
5 Correct 604 ms 880 KB Output is correct
6 Correct 466 ms 800 KB Output is correct
7 Correct 429 ms 804 KB Output is correct
8 Correct 2 ms 768 KB Output is correct
9 Correct 5 ms 768 KB Output is correct
10 Correct 0 ms 884 KB Output is correct
11 Incorrect 1 ms 384 KB Invalid labels (duplicates values). scenario=1, label=2
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 853 ms 768 KB Output is correct
2 Correct 710 ms 876 KB Output is correct
3 Correct 590 ms 880 KB Output is correct
4 Correct 2 ms 768 KB Output is correct
5 Correct 4 ms 768 KB Output is correct
6 Correct 1 ms 768 KB Output is correct
7 Incorrect 0 ms 512 KB Invalid labels (duplicates values). scenario=0, label=2
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 540 ms 768 KB Output is correct
2 Correct 448 ms 796 KB Output is correct
3 Correct 886 ms 884 KB Output is correct
4 Correct 658 ms 884 KB Output is correct
5 Correct 604 ms 884 KB Output is correct
6 Correct 446 ms 800 KB Output is correct
7 Correct 427 ms 804 KB Output is correct
8 Correct 2 ms 892 KB Output is correct
9 Correct 4 ms 884 KB Output is correct
10 Correct 1 ms 768 KB Output is correct
11 Incorrect 4 ms 384 KB Invalid labels (duplicates values). scenario=0, label=10
12 Halted 0 ms 0 KB -