Submission #845071

# Submission time Handle Problem Language Result Execution time Memory
845071 2023-09-06T11:50:16 Z vjudge1 Birmingham (COCI20_birmingham) C++17
0 / 70
170 ms 13472 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define endl "\n"
#define all(aa) aa.begin(), aa.end()

int main(){
	double k;
	ll n, m, qq;
	cin>>n>>m>>qq>>k;

	queue<pair<ll, ll>> q;
	for(ll i=0; i<qq; i++){
		ll a;
		cin>>a;
		q.push({a-1, 0});
	}

	vector<vector<ll>> g(n);
	for(ll i=0; i<m; i++){
		ll a, b;
		cin>>a>>b;
		a--; b--;

		g[a].push_back(b);
		g[b].push_back(a);
	}

	vector<ll> ans(n, -1);
	while(q.size()){
		auto[v, d]=q.front();
		q.pop();

		if(ans[v]!=-1) continue;
		cout<<v<<' '<<d<<endl;
		ans[v]=ceil((sqrt(k*k/4+2*k*d)-k/2)/k);

		for(auto ch:g[v])
			if(ans[v]!=-1) q.push({ch, d+1});
	}
	for(auto e:ans) cout<<e<<' ';
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 170 ms 12280 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 166 ms 13472 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 128 ms 12628 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 120 ms 11808 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 129 ms 11764 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 121 ms 11968 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 150 ms 12196 KB Output isn't correct
2 Halted 0 ms 0 KB -