結果

問題 No.800 四平方定理
ユーザー SuikabaSuikaba
提出日時 2019-03-17 21:30:43
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 482 bytes
コンパイル時間 1,955 ms
コンパイル使用メモリ 197,384 KB
実行使用メモリ 103,584 KB
最終ジャッジ日時 2023-09-22 03:57:15
合計ジャッジ時間 4,578 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
5,700 KB
testcase_01 AC 7 ms
5,952 KB
testcase_02 AC 8 ms
5,868 KB
testcase_03 AC 8 ms
6,044 KB
testcase_04 AC 8 ms
5,900 KB
testcase_05 AC 8 ms
5,888 KB
testcase_06 AC 8 ms
6,048 KB
testcase_07 AC 8 ms
6,380 KB
testcase_08 AC 9 ms
8,100 KB
testcase_09 AC 8 ms
6,000 KB
testcase_10 AC 53 ms
56,628 KB
testcase_11 AC 57 ms
58,684 KB
testcase_12 AC 60 ms
60,604 KB
testcase_13 AC 47 ms
52,672 KB
testcase_14 AC 52 ms
56,584 KB
testcase_15 AC 58 ms
60,632 KB
testcase_16 AC 55 ms
58,684 KB
testcase_17 AC 53 ms
58,636 KB
testcase_18 AC 66 ms
66,788 KB
testcase_19 AC 67 ms
66,832 KB
testcase_20 AC 7 ms
5,348 KB
testcase_21 AC 8 ms
5,352 KB
testcase_22 AC 67 ms
66,944 KB
testcase_23 WA -
testcase_24 AC 100 ms
95,876 KB
testcase_25 WA -
testcase_26 AC 7 ms
5,320 KB
testcase_27 AC 8 ms
7,636 KB
testcase_28 AC 100 ms
95,104 KB
testcase_29 WA -
testcase_30 AC 97 ms
95,292 KB
testcase_31 AC 90 ms
89,000 KB
testcase_32 AC 99 ms
96,604 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

using ll = long long;

ll l[1 << 23], r[1 << 23];

int main() {
    int n, d; cin >> n >> d;
    for(int a = 1; a <= n; ++a) {
        for(int b = 1; b <= n; ++b) {
            l[a * a + b * b] += 1;
            if(a * a - b * b + d >= 0) {
                r[a * a - b * b + d] += 1;
            }
        }
    }

    ll ans = 0;
    for(int i = 0; i < 1 << 22; ++i) {
        ans += l[i] * r[i];
    }
    
    cout << ans << endl;
}
0