Submission #432733

# Submission time Handle Problem Language Result Execution time Memory
432733 2021-06-18T12:56:01 Z A_D Stations (IOI20_stations) C++14
0 / 100
3000 ms 2097156 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 Runtime error 1 ms 412 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3018 ms 1400 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1969 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1001 ms 488 KB Output is correct
2 Runtime error 1410 ms 2097156 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3147 ms 1859728 KB Time limit exceeded
2 Halted 0 ms 0 KB -