結果

問題 No.800 四平方定理
ユーザー BwambocosBwambocos
提出日時 2019-03-17 23:27:14
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 482 bytes
コンパイル時間 1,427 ms
コンパイル使用メモリ 166,904 KB
実行使用メモリ 67,872 KB
最終ジャッジ日時 2023-09-22 11:28:17
合計ジャッジ時間 10,845 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 21 ms
67,528 KB
testcase_08 AC 21 ms
67,324 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 21 ms
67,324 KB
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 AC 21 ms
67,344 KB
testcase_27 AC 19 ms
67,520 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(4123456), cnt2(4123456);
	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