답안 #336976

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
336976 2020-12-17T14:35:27 Z Register 기지국 (IOI20_stations) C++14
0 / 100
3000 ms 2097156 KB
#include <bits/stdc++.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,1);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:10:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |  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 3047 ms 2284 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1486 ms 2097152 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 882 ms 1060 KB Output is correct
2 Runtime error 1250 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 2473 ms 2097156 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -