Submission #336970

# Submission time Handle Problem Language Result Execution time Memory
336970 2020-12-17T14:11:36 Z Register Stations (IOI20_stations) C++14
0 / 100
3000 ms 2097156 KB
#include <bits/stdc++.h>
#include "stations.h"
#define y e[x][i]
using namespace std;
typedef vector<int> vec;
int sum;
vector<vec> e;
vec res;
void dfs(int x,int fa,bool d){
	if(d) res[x]=sum++;
	for(int i=0;i<e[x].size();i++)
		if(y!=fa) dfs(y,x,d^1);
	if(!d) res[x]=sum++;
}
vec label(int n,int k,vec u,vec v){
	res.resize(n);e.resize(n,vec());
	for(int i=0;i<n-1;i++) {e[u[i]].push_back(v[i]);e[v[i]].push_back(u[i]);}
	sum=0;dfs(0,-1,0);return res;
}
int find_next_station(int s,int t,vec c){
	if(c[0]>s){
		if(t<s||c.back()<t) return c.back();
		return *lower_bound(c.begin(),c.end(),t);
	}
	if(t<c[0]||s<t) return c[0];
	return *(upper_bound(c.begin(),c.end(),t)-1);
}

Compilation message

stations.cpp: In function 'void dfs(int, int, bool)':
stations.cpp:11:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |  for(int i=0;i<e[x].size();i++)
      |              ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3080 ms 2156 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2274 ms 2097156 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 887 ms 756 KB Output is correct
2 Runtime error 1262 ms 2097156 KB Execution killed with signal 9 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2483 ms 2097156 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -