Codeforces Round #420 (Div. 2), problem: (D) Okabe and City Solution In C/C++

By |2017-08-06T21:25:24+00:00August 6th, 2017|Categories: C/C++, Programming|Tags: , , , , , , , |

#include<iostream> #include<cstdio> #include<cstring> #include<queue> #include<cmath> using namespace std; const int maxn=1e4+5; const int inf=0x7f7f7f7f; int x[maxn],y[maxn],dis[maxn]; bool vis[maxn]; int k,n,m; int bfs() { queue<int>q; q.push(1); //memset //for(int i=1;i<=n;i++)dis[i]=inf; memset(dis,0x7f,sizeof dis); dis[1]=0; vis[1]=true; while(!q.empty()) { int u; u=q.front();q.pop(); for(int i=1;i<=k;i++) { if(u==i)continue; int w=inf; int [...]