Submission #432701

# Submission time Handle Problem Language Result Execution time Memory
432701 2021-06-18T12:33:23 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;
int in=0;
int out=0;
void dfs(int u,int p)
{
    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){
    g.resize(n);
	ret.resize(n);
	for(int i=0;i<u.size();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 = s%1024;
    int outt = (s>>(10));
    vector<int> in;
    vector<int> out;
    for(int i=0;i<c.size();i++){
        in.push_back(c[i]%1024);
        out.push_back((c[i]>>(10)));
//        cout<<in[i]<<" "<<out[i]<<endl;
    }
    int mx=-1;
    for(int i=0;i<c.size();i++){
        mx=max(mx,c[i]);
    }
    for(int i=0;i<c.size();i++){
        if(mx==c[i])continue;
        if(in[i]<=inn&&outt<=out[i])return c[i];
    }
    return mx;
}

Compilation message

stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:22:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |  for(int i=0;i<u.size();i++){
      |              ~^~~~~~~~~
stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:36:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |     for(int i=0;i<c.size();i++){
      |                 ~^~~~~~~~~
stations.cpp:42:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |     for(int i=0;i<c.size();i++){
      |                 ~^~~~~~~~~
stations.cpp:45:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |     for(int i=0;i<c.size();i++){
      |                 ~^~~~~~~~~
stations.cpp:31:9: warning: unused variable 'n' [-Wunused-variable]
   31 |     int n=c.size();
      |         ^
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 416 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3053 ms 1484 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1685 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 849 ms 492 KB Output is correct
2 Runtime error 1337 ms 2097156 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3173 ms 1960768 KB Time limit exceeded
2 Halted 0 ms 0 KB -