結果

問題 No.800 四平方定理
ユーザー mine691mine691
提出日時 2019-03-17 22:44:20
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 728 bytes
コンパイル時間 1,425 ms
コンパイル使用メモリ 170,228 KB
実行使用メモリ 159,372 KB
最終ジャッジ日時 2023-09-22 08:47:15
合計ジャッジ時間 4,520 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,752 KB
testcase_01 AC 4 ms
6,008 KB
testcase_02 AC 3 ms
5,096 KB
testcase_03 AC 4 ms
5,416 KB
testcase_04 AC 3 ms
4,888 KB
testcase_05 AC 3 ms
5,156 KB
testcase_06 AC 4 ms
6,784 KB
testcase_07 AC 4 ms
5,676 KB
testcase_08 AC 4 ms
6,780 KB
testcase_09 AC 3 ms
5,900 KB
testcase_10 AC 42 ms
80,384 KB
testcase_11 AC 48 ms
89,960 KB
testcase_12 AC 47 ms
88,436 KB
testcase_13 AC 44 ms
84,008 KB
testcase_14 AC 48 ms
90,080 KB
testcase_15 AC 47 ms
89,236 KB
testcase_16 AC 47 ms
90,924 KB
testcase_17 AC 48 ms
90,800 KB
testcase_18 AC 49 ms
90,528 KB
testcase_19 AC 47 ms
90,748 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 47 ms
90,752 KB
testcase_23 AC 114 ms
159,332 KB
testcase_24 AC 106 ms
159,372 KB
testcase_25 AC 92 ms
158,896 KB
testcase_26 AC 1 ms
4,376 KB
testcase_27 RE -
testcase_28 AC 101 ms
158,564 KB
testcase_29 AC 124 ms
159,036 KB
testcase_30 AC 107 ms
159,064 KB
testcase_31 AC 94 ms
147,776 KB
testcase_32 AC 101 ms
159,304 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
const ll inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

ll n, d, ans;
map<int, int> X, Y;

int main()
{
    cin >> n >> d;
    vector<int> X(4 * n * n), Y(6 * n * n);
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= n; j++)
        {
            X[i * i + j * j]++;
        }
    }
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= n; j++)
        {
            Y[i * i - j * j + 3 * n * n]++;
        }
    }
    for (int i = 1; i <= 2 * n * n; i++)
    {
        ans += X[i] * Y[d - i + 3 * n * n];
        //printf("X:%d Y:%d i:%d\n", X[i], Y[d - i], i);
    }
    cout << ans << endl;
}
0