답안 #237634

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
237634 2020-06-07T23:29:36 Z akat Birmingham (COCI20_birmingham) C++14
35 / 70
140 ms 18156 KB
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5+1;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n,m,s,k,i,j,a,b,dist[N],wave[N];
	vector<int>adj[N];
	cin>>n>>m>>s>>k;
	memset(dist,-1,sizeof(dist));
	queue<int>q;
	for(i = 0; i < s; i++)
	{
		cin>>a;
		q.push(a);
		dist[a] = 0;
	}
	for(i = 0; i < m; i++)
	{
		cin>>a>>b;
		adj[a].emplace_back(b);
		adj[b].emplace_back(a);
	}
	while(q.size())
	{
		a = q.front();
		q.pop();
		for(int x:adj[a])
		{
			if(dist[x] == -1)
			{
				dist[x] = dist[a] + 1;
				q.push(x);
			}
		}
	}
	wave[0] = 0;
	int curr = 0, old = 0;
	for(i = 1; curr < n; i++)
	{
		old = curr;
		curr += k * i;
		for(j = old + 1; j <= curr; j++)
			wave[j] = i;
	}
	for(i=1;i<=n;i++)
		cout<<wave[dist[i]]<<" \n"[i==n];
}
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 2944 KB Output is correct
2 Correct 6 ms 3072 KB Output is correct
3 Correct 6 ms 3072 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 3072 KB Output is correct
2 Correct 6 ms 3072 KB Output is correct
3 Correct 6 ms 3072 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 3072 KB Output is correct
2 Correct 7 ms 3072 KB Output is correct
3 Correct 6 ms 3072 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 3072 KB Output is correct
2 Correct 7 ms 3072 KB Output is correct
3 Correct 6 ms 3072 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 3072 KB Output is correct
2 Correct 6 ms 3072 KB Output is correct
3 Correct 6 ms 3072 KB Output is correct
4 Correct 6 ms 3072 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 3072 KB Output is correct
2 Correct 6 ms 3072 KB Output is correct
3 Correct 7 ms 3072 KB Output is correct
4 Correct 6 ms 3072 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 3072 KB Output is correct
2 Correct 7 ms 3072 KB Output is correct
3 Correct 6 ms 3072 KB Output is correct
4 Correct 6 ms 3072 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 101 ms 17504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 118 ms 18156 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 100 ms 17496 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 112 ms 16940 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 98 ms 17000 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 140 ms 17140 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 105 ms 17348 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -