답안 #336969

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
336969 2020-12-17T14:09:22 Z Register 기지국 (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++)
      |              ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3062 ms 2284 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1936 ms 2097156 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 912 ms 876 KB Output is correct
2 Runtime error 1238 ms 2097156 KB Execution killed with signal 9 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2416 ms 2097156 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -