Submission #432826

# Submission time Handle Problem Language Result Execution time Memory
432826 2021-06-18T13:41:33 Z Rouge_Hugo Stations (IOI20_stations) C++14
5 / 100
923 ms 612 KB
#include<bits/stdc++.h>
#include "stations.h"
#define ll long long
#define fi first
#define se second
#define pb push_back
using namespace std;
const int N=1009;
int la[N];
vector<int>v[N];int re=-1;
void dfs(int x,int p)
{
    la[x]=++re;
    for(auto it:v[x])
    {
        if(it==p)continue;
        dfs(it,x);
    }
}
vector<int> label(int n, int k,vector<int> U, vector<int> V) {
	vector<int> l(n);
	for(int  i=0;i<n-1;i++)
    {
        v[U[i]].pb(V[i]);
        v[V[i]].pb(U[i]);
    }
    int root=0;
    for(int i=0;i<n;i++)if(v[i].size()==1)root=i;
    re=-1;
    dfs(root,-1);
    for(int i=0;i<n;i++)l[i]=la[i];
    memset(la,0,sizeof la);for(int i=0;i<n;i++)v[i].clear();
    return l;
}

int find_next_station(int s, int t, std::vector<int> c) {
    sort(c.begin(),c.end());
    if(c.size()==1)return c[0];
	if(s<t)
    {
        return c[1];
    }
    return c[0];
}
/*
1
4 1000
1 2
2 0
0 3
2
2 0 0
1 3 2
*/
# Verdict Execution time Memory Grader output
1 Correct 550 ms 512 KB Output is correct
2 Correct 451 ms 508 KB Output is correct
3 Correct 912 ms 400 KB Output is correct
4 Correct 659 ms 400 KB Output is correct
5 Correct 580 ms 516 KB Output is correct
6 Correct 466 ms 504 KB Output is correct
7 Correct 479 ms 536 KB Output is correct
8 Correct 3 ms 448 KB Output is correct
9 Correct 5 ms 472 KB Output is correct
10 Correct 2 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 460 ms 508 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 558 ms 504 KB Output is correct
2 Correct 454 ms 584 KB Output is correct
3 Correct 923 ms 528 KB Output is correct
4 Correct 731 ms 596 KB Output is correct
5 Correct 590 ms 400 KB Output is correct
6 Correct 424 ms 504 KB Output is correct
7 Correct 472 ms 508 KB Output is correct
8 Correct 3 ms 472 KB Output is correct
9 Correct 6 ms 468 KB Output is correct
10 Correct 2 ms 468 KB Output is correct
11 Incorrect 614 ms 508 KB Wrong query response.
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 841 ms 400 KB Output is correct
2 Correct 631 ms 476 KB Output is correct
3 Correct 580 ms 400 KB Output is correct
4 Correct 4 ms 476 KB Output is correct
5 Correct 5 ms 468 KB Output is correct
6 Correct 2 ms 476 KB Output is correct
7 Incorrect 551 ms 572 KB Wrong query response.
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 569 ms 612 KB Output is correct
2 Correct 459 ms 528 KB Output is correct
3 Correct 894 ms 488 KB Output is correct
4 Correct 643 ms 400 KB Output is correct
5 Correct 547 ms 400 KB Output is correct
6 Correct 439 ms 596 KB Output is correct
7 Correct 420 ms 512 KB Output is correct
8 Correct 3 ms 476 KB Output is correct
9 Correct 3 ms 468 KB Output is correct
10 Correct 2 ms 468 KB Output is correct
11 Incorrect 440 ms 504 KB Wrong query response.
12 Halted 0 ms 0 KB -