結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,728 KB
testcase_01 AC 4 ms
6,056 KB
testcase_02 AC 3 ms
5,088 KB
testcase_03 AC 4 ms
5,464 KB
testcase_04 AC 3 ms
4,852 KB
testcase_05 AC 3 ms
5,528 KB
testcase_06 AC 5 ms
6,584 KB
testcase_07 AC 4 ms
5,728 KB
testcase_08 AC 4 ms
6,580 KB
testcase_09 AC 4 ms
6,256 KB
testcase_10 AC 52 ms
80,272 KB
testcase_11 AC 62 ms
90,004 KB
testcase_12 AC 60 ms
88,464 KB
testcase_13 AC 54 ms
83,932 KB
testcase_14 AC 62 ms
90,004 KB
testcase_15 AC 62 ms
89,476 KB
testcase_16 AC 63 ms
90,764 KB
testcase_17 AC 62 ms
90,808 KB
testcase_18 AC 63 ms
90,684 KB
testcase_19 AC 63 ms
90,536 KB
testcase_20 AC 2 ms
4,384 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 64 ms
90,808 KB
testcase_23 AC 200 ms
159,136 KB
testcase_24 AC 118 ms
159,252 KB
testcase_25 AC 118 ms
158,968 KB
testcase_26 AC 1 ms
4,376 KB
testcase_27 RE -
testcase_28 AC 115 ms
158,456 KB
testcase_29 AC 117 ms
159,060 KB
testcase_30 AC 117 ms
158,796 KB
testcase_31 AC 104 ms
147,800 KB
testcase_32 AC 115 ms
159,372 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 + 2 * n * n]++;
        }
    }
    for (int i = 1; i <= 2 * n * n; i++)
    {
        ans += X[i] * Y[d - i + 2 * n * n];
        //printf("X:%d Y:%d i:%d\n", X[i], Y[d - i], i);
    }
    cout << ans << endl;
}
0