Submission #432708

# Submission time Handle Problem Language Result Execution time Memory
432708 2021-06-18T12:39:25 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 = t%1024;
    int outt = (t>>(10));
//    cout<<inn<<" "<<outt<<endl;
    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]<<" "<<c[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:37:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |     for(int i=0;i<c.size();i++){
      |                 ~^~~~~~~~~
stations.cpp:43:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |     for(int i=0;i<c.size();i++){
      |                 ~^~~~~~~~~
stations.cpp:46:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |     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 300 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3038 ms 1572 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1704 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 941 ms 400 KB Output is correct
2 Runtime error 1282 ms 2097156 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3149 ms 2097156 KB Time limit exceeded
2 Halted 0 ms 0 KB -