結果

問題 No.1274 楽しい格子点
ユーザー furafura
提出日時 2020-10-30 22:23:40
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 941 bytes
コンパイル時間 2,158 ms
コンパイル使用メモリ 206,852 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-29 06:57:30
合計ジャッジ時間 4,560 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 WA -
testcase_03 AC 2 ms
4,380 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 1 ms
4,376 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 1 ms
4,376 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 2 ms
4,380 KB
testcase_29 AC 1 ms
4,376 KB
testcase_30 AC 2 ms
4,380 KB
testcase_31 AC 2 ms
4,376 KB
testcase_32 AC 2 ms
4,376 KB
testcase_33 AC 2 ms
4,380 KB
testcase_34 AC 1 ms
4,376 KB
testcase_35 AC 1 ms
4,376 KB
testcase_36 AC 1 ms
4,380 KB
testcase_37 AC 1 ms
4,380 KB
testcase_38 AC 1 ms
4,376 KB
testcase_39 AC 2 ms
4,376 KB
testcase_40 AC 2 ms
4,380 KB
testcase_41 AC 1 ms
4,380 KB
testcase_42 AC 2 ms
4,376 KB
testcase_43 AC 1 ms
4,376 KB
testcase_44 AC 2 ms
4,376 KB
testcase_45 AC 1 ms
4,376 KB
testcase_46 AC 2 ms
4,380 KB
testcase_47 AC 1 ms
4,376 KB
testcase_48 AC 2 ms
4,380 KB
testcase_49 WA -
testcase_50 AC 2 ms
4,376 KB
testcase_51 AC 1 ms
4,376 KB
testcase_52 AC 1 ms
4,376 KB
testcase_53 AC 2 ms
4,376 KB
testcase_54 AC 2 ms
4,376 KB
testcase_55 AC 3 ms
4,376 KB
testcase_56 AC 2 ms
4,376 KB
testcase_57 AC 2 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;
using lint=long long;

int main(){
	lint a,b; scanf("%lld%lld",&a,&b);

	if(a<0) a*=-1;
	if(b<0) b*=-1;

	if((a==0 && b==0) || (a>10 && b>10)){
		puts("0.25");
		return 0;
	}

	const int OFS=100;
	bool vis[200][200]={};
	vis[1+OFS][1+OFS]=true;

	queue<pair<int,int>> Q; Q.emplace(1,1);
	while(!Q.empty()){
		int x,y;
		tie(x,y)=Q.front(); Q.pop();

		auto update=[&](int dx,int dy){
			int x2=x+dx,y2=y+dy;
			if(-OFS<=x2 && x2<OFS && -OFS<=y2 && y2<OFS && !vis[x2+OFS][y2+OFS]){
				vis[x2+OFS][y2+OFS]=true;
				Q.emplace(x2,y2);
			}
		};

		update( a, b);
		update( a,-b);
		update(-a, b);
		update(-a,-b);
		update( b, a);
		update( b,-a);
		update(-b, a);
		update(-b,-a);
	}

	double ans=0;
	for(int x=1;x<OFS;x++){
		for(int y=1;y<OFS;y++){
			if(vis[x+OFS][y+OFS]){
				ans+=1.0/pow(x+y,x+y);
			}
		}
	}
	printf("%.15f\n",ans);

	return 0;
}
0