結果

問題 No.800 四平方定理
ユーザー mine691mine691
提出日時 2019-03-17 22:45:10
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 706 bytes
コンパイル時間 1,576 ms
コンパイル使用メモリ 166,744 KB
実行使用メモリ 315,636 KB
最終ジャッジ日時 2023-09-22 08:50:49
合計ジャッジ時間 6,227 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
6,280 KB
testcase_01 AC 6 ms
8,900 KB
testcase_02 AC 5 ms
7,188 KB
testcase_03 AC 4 ms
8,020 KB
testcase_04 AC 4 ms
7,028 KB
testcase_05 AC 5 ms
7,476 KB
testcase_06 AC 6 ms
10,124 KB
testcase_07 AC 5 ms
8,288 KB
testcase_08 AC 5 ms
10,080 KB
testcase_09 AC 5 ms
8,960 KB
testcase_10 AC 95 ms
157,480 KB
testcase_11 AC 97 ms
176,880 KB
testcase_12 AC 94 ms
173,904 KB
testcase_13 AC 89 ms
165,032 KB
testcase_14 AC 97 ms
176,940 KB
testcase_15 AC 95 ms
175,724 KB
testcase_16 AC 100 ms
178,772 KB
testcase_17 AC 98 ms
178,612 KB
testcase_18 AC 97 ms
178,200 KB
testcase_19 AC 97 ms
178,396 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 97 ms
178,660 KB
testcase_23 AC 278 ms
315,636 KB
testcase_24 AC 233 ms
315,568 KB
testcase_25 AC 226 ms
314,612 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 RE -
testcase_28 AC 226 ms
313,892 KB
testcase_29 AC 227 ms
314,768 KB
testcase_30 AC 225 ms
314,228 KB
testcase_31 AC 197 ms
292,324 KB
testcase_32 AC 227 ms
315,632 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;

int main()
{
    cin >> n >> d;
    vector<ll> 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 (ll 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