Submission #432723

# Submission time Handle Problem Language Result Execution time Memory
432723 2021-06-18T12:52:17 Z A_D Stations (IOI20_stations) C++14
0 / 100
863 ms 480 KB
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> ret;
vector<vector<int>> g;
vector<bool> vis;
int in=0;
int out=0;
void dfs(int u,int p)
{
    if(vis[u])return;
    vis[u]=1;
    ret[u]+=in++;
    for(auto x:g[u]){
        if(x==p)continue;
        dfs(x,u);
    }
    int h=(out<<10);
    out++;
    ret[u]+=h;
}
vector<int> label(int n, int k,vector<int> u,vector<int> v){
    vis.resize(n);
    g.resize(n);
	ret.resize(n);
	for(int i=0;i<n-1;i++){
        g[u[i]].push_back(v[i]);
        g[v[i]].push_back(u[i]);
	}
	dfs(0,0);

	return ret;
}

int find_next_station(int s, int t,vector<int> c){
    int n=c.size();
    int inn = t%1024;
    int outt = (t>>(10));
//    cout<<inn<<" "<<outt<<endl;
    vector<int> in;
    vector<int> out;
    for(int i=0;i<n;i++){
        in.push_back(c[i]%1024);
        out.push_back((c[i]>>(10)));
  //     cout<<in[i]<<" "<<out[i]<<" "<<c[i]<<endl;
    }
    int mx=-1;
    for(int i=0;i<n;i++){
        mx=max(mx,c[i]);
    }
    for(int i=0;i<n;i++){
        if(mx==c[i])continue;
        if(in[i]<=inn&&outt<=out[i])return c[i];
    }
    return mx;
}
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 328 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=0, label=9216
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 416 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=0, label=1018880
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 396 KB Invalid labels (duplicates values). scenario=1, label=0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 863 ms 468 KB Output is correct
2 Correct 676 ms 404 KB Output is correct
3 Incorrect 555 ms 480 KB Wrong query response.
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 464 KB Invalid labels (duplicates values). scenario=1, label=0
2 Halted 0 ms 0 KB -