Language: C++

#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <string.h>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>

using namespace std;

typedef pair<long long int, long long int> P;
long long int INF = 1e18;

#define MAX_V 200
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <string.h>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>

using namespace std;

typedef pair<long long int, long long int> P;
long long int INF = 1e18;

#define MAX_V 200

typedef vector<double> vec;
typedef vector<vec> mat;

int V;
double r, theta, E_sz[500];

// A*B の計算
mat mul(mat &A, mat &B){
	mat C(A.size(), vec(B[0].size()));
	for(int i = 0; i < A.size(); i++){
		for(int j = 0; j < B[0].size(); j++){
			double mini = INF;
			for(int k = 0; k < B.size(); k++){
				mini = min(mini, A[i][k] + B[k][j]);
			}
			C[i][j] = mini;
		}
	}
	return C;
}

// A^n の計算
int mat_pow(mat A){
	mat B(A.size(), vec(A.size()));
	for(int i = 0; i < A.size(); i++){
		B[i][i] = 1;
	}
	int num = 0;
	while(true){
		B = mul(B, A);
		bool flag = true;
		for(int i = 0; i < V * V; i++){
			for(int j = 0; j < V * V; j++){
				if(B[i][j] + E_sz[i] < r){
					flag = false;
				}
			}
		}
		if(flag){
			break;
		}
		num++;
	}
	return num;
}

int main(){
	
	cin >> V;
	
	cin >> r >> theta;
	
	theta = theta * M_PI / 180;
	
	mat S(V * V, vec(V * V));
	
	double x[30], y[30];
	
	for(int i = 0; i < V; i++){
		cin >> x[i] >> y[i];
	}
	
	for(int i = 0; i < V * V; i++){
		E_sz[i] = INF;
		for(int j = 0; j < V * V; j++){
			S[i][j] = INF;
		}
	}
	
	for(int i = 0; i < V; i++){
		for(int j = 0; j < V; j++){
			if(i == j){
				continue;
			}
			double vx1, vx2, vy1, vy2;
			vx1 = x[j] - x[i];
			vy1 = y[j] - y[i];
			double norm1 = sqrt(vx1 * vx1 + vy1 * vy1);
			E_sz[i * V + j] = norm1;
			
			for(int k = 0; k < V; k++){
				if(j == k || k == i){
					continue;
				}
				vx2 = x[k] - x[j];
				vy2 = y[k] - y[j];
				double inn = vx1 * vx2 + vy1 * vy2;
				double norm2 = sqrt(vx2 * vx2 + vy2 * vy2);
				double th = acos(inn * inn / norm1 / norm2);
				if(M_PI - th < theta){
					S[i * V + j][j * V + k] = norm2;
					//S[j * V + i][k * V + j] = norm2;
					//S[j * V + k][i * V + j] = norm1;
					S[k * V + j][j * V + i] = norm1;
					//cout << i * V + j << " " << j * V + k << " " << norm2 << endl;
					//cout << k * V + j << " " << j * V + i << " " << norm1 << endl;
				}
			}
		}
	}
	
	bool flag = true;
	for(int i = 0; i < V * V; i++){
		if(E_sz[i] < r){
			flag = false;
		}
	}
	
	if(flag){
		cout << 0 << endl;
		return 0;
	}
	
	cout << mat_pow(S) + 1 << endl;
	
	return 0;
}
typedef vector<double> vec;
typedef vector<vec> mat;

int V;
double r, theta, E_sz[500];

// A*B の計算
mat mul(mat &A, mat &B){
	mat C(A.size(), vec(B[0].size()));
	for(int i = 0; i < A.size(); i++){
		for(int j = 0; j < B[0].size(); j++){
			double mini = INF;
			for(int k = 0; k < B.size(); k++){
				mini = min(mini, A[i][k] + B[k][j]);
			}
			C[i][j] = mini;
		}
	}
	return C;
}

// A^n の計算
int mat_pow(mat A){
	mat B(A.size(), vec(A.size()));
	for(int i = 0; i < A.size(); i++){
		B[i][i] = 1;
	}
	int num = 0;
	while(true){
		B = mul(B, A);
		bool flag = true;
		for(int i = 0; i < V * V; i++){
			for(int j = 0; j < V * V; j++){
				if(B[i][j] + E_sz[i] < r){
					flag = false;
				}
			}
		}
		if(flag){
			break;
		}
		num++;
	}
	return num;
}

int main(){
	
	cin >> V;
	
	cin >> r >> theta;
	
	theta = theta * M_PI / 180;
	
	mat S(V * V, vec(V * V));
	
	double x[30], y[30];
	
	for(int i = 0; i < V; i++){
		cin >> x[i] >> y[i];
	}
	
	for(int i = 0; i < V * V; i++){
		E_sz[i] = INF;
		for(int j = 0; j < V * V; j++){
			S[i][j] = INF;
		}
	}
	
	for(int i = 0; i < V; i++){
		for(int j = 0; j < V; j++){
			for(int k = 0; k < V; k++){
				if(i == j || j == k || k == i){
					continue;
				}
				double vx1, vx2, vy1, vy2;
				vx1 = x[j] - x[i];
				vy1 = y[j] - y[i];
				vx2 = x[k] - x[j];
				vy2 = y[k] - y[j];
				double inn = vx1 * vx2 + vy1 * vy2;
				double norm1 = sqrt(vx1 * vx1 + vy1 * vy1);
				double norm2 = sqrt(vx2 * vx2 + vy2 * vy2);
				E_sz[i * V + j] = norm1;
				E_sz[k * V + j] = norm2;
				double th = acos(inn * inn / norm1 / norm2);
				if(M_PI - th < theta){
					S[i * V + j][j * V + k] = norm2;
					//S[j * V + i][k * V + j] = norm2;
					//S[j * V + k][i * V + j] = norm1;
					S[k * V + j][j * V + i] = norm1;
					//cout << i * V + j << " " << j * V + k << " " << norm2 << endl;
					//cout << k * V + j << " " << j * V + i << " " << norm1 << endl;
				}
			}
		}
	}
	
	bool flag = true;
	for(int i = 0; i < V * V; i++){
		if(E_sz[i] < r){
			flag = false;
		}
	}
	
	if(flag){
		cout << 0 << endl;
		return 0;
	}
	
	cout << mat_pow(S) + 1 << endl;
	
	return 0;
}


Compiler output:
a.cc:36:15: error: redefinition of 'long long int INF'
   36 | long long int INF = 1e18;
      |               ^~~
a.cc:17:15: note: 'long long int INF' previously defined here
   17 | long long int INF = 1e18;
      |               ^~~
a.cc:160:5: error: redefinition of 'int V'
  160 | int V;
      |     ^
a.cc:43:5: note: 'int V' previously declared here
   43 | int V;
      |     ^
a.cc:161:8: error: redefinition of 'double r'
  161 | double r, theta, E_sz[500];
      |        ^
a.cc:44:8: note: 'double r' previously declared here
   44 | double r, theta, E_sz[500];
      |        ^
a.cc:161:11: error: redefinition of 'double theta'
  161 | double r, theta, E_sz[500];
      |           ^~~~~
a.cc:44:11: note: 'double theta' previously declared here
   44 | double r, theta, E_sz[500];
      |           ^~~~~
a.cc:161:18: error: redefinition of 'double E_sz [500]'
  161 | double r, theta, E_sz[500];
      |                  ^~~~
a.cc:44:18: note: 'double E_sz [500]' previously declared here
   44 | double r, theta, E_sz[500];
      |                  ^~~~
a.cc:164:5: error: redefinition of 'mat mul(mat&, mat&)'
  164 | mat mul(mat &A, mat &B){
      |     ^~~
a.cc:47:5: note: 'mat mul(mat&, mat&)' previously defined here
   47 | mat mul(mat &A, mat &B){
      |     ^~~
a.cc:179:5: error: redefinition of 'int mat_pow(mat)'
  179 | int mat_pow(mat A){
      |     ^~~~~~~
a.cc:62:5: note: 'int mat_pow(mat)' previously defined here
   62 | int mat_pow(mat A){
      |     ^~~~~~~
a.cc:203:5: error: redefinition of 'int main()'
  203 | int main(){
      |     ^~~~
a.cc:86:5: note: 'int main()' previously defined here
   86 | int main(){
      |     ^~~~