結果

問題 No.800 四平方定理
ユーザー BwambocosBwambocos
提出日時 2019-03-17 23:27:50
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 482 bytes
コンパイル時間 2,496 ms
コンパイル使用メモリ 165,728 KB
実行使用メモリ 130,368 KB
最終ジャッジ日時 2023-09-22 11:31:23
合計ジャッジ時間 18,183 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 36 ms
129,852 KB
testcase_08 AC 37 ms
129,888 KB
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 AC 35 ms
129,904 KB
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 AC 36 ms
129,992 KB
testcase_27 AC 35 ms
129,852 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

int main()
{
	LL N, D;
	in >> N >> D;

	std::vector<LL>cnt1(8123456), cnt2(8123456);
	for (LL x = 1; x <= N; ++x) for (LL y = 1; y <= N; ++y) ++cnt1[x*x + y * y];
	for (LL w = 1; w <= N; ++w) for (LL z = 1; z <= N; ++z) ++cnt2[w*w - z * z + D];

	LL ans = 0;
	for (LL i = 1; i <= 2 * N * N; ++i) ans += cnt1[i] * cnt2[i];

	out << ans << std::endl;
}
0