結果

問題 No.800 四平方定理
ユーザー face4face4
提出日時 2019-03-17 21:58:20
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 465 bytes
コンパイル時間 611 ms
コンパイル使用メモリ 73,708 KB
実行使用メモリ 65,556 KB
最終ジャッジ日時 2023-09-22 05:54:28
合計ジャッジ時間 4,215 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
65,364 KB
testcase_01 AC 24 ms
65,324 KB
testcase_02 AC 24 ms
65,472 KB
testcase_03 AC 25 ms
65,432 KB
testcase_04 AC 24 ms
65,264 KB
testcase_05 AC 25 ms
65,328 KB
testcase_06 AC 26 ms
65,256 KB
testcase_07 AC 24 ms
65,320 KB
testcase_08 AC 25 ms
65,476 KB
testcase_09 AC 26 ms
65,432 KB
testcase_10 AC 73 ms
65,460 KB
testcase_11 AC 81 ms
65,540 KB
testcase_12 AC 83 ms
65,476 KB
testcase_13 AC 76 ms
65,540 KB
testcase_14 AC 77 ms
65,260 KB
testcase_15 AC 77 ms
65,252 KB
testcase_16 AC 82 ms
65,324 KB
testcase_17 AC 79 ms
65,480 KB
testcase_18 AC 79 ms
65,324 KB
testcase_19 AC 76 ms
65,520 KB
testcase_20 AC 24 ms
65,408 KB
testcase_21 AC 25 ms
65,428 KB
testcase_22 AC 76 ms
65,404 KB
testcase_23 WA -
testcase_24 AC 130 ms
65,460 KB
testcase_25 WA -
testcase_26 AC 25 ms
65,364 KB
testcase_27 AC 24 ms
65,324 KB
testcase_28 AC 129 ms
65,528 KB
testcase_29 WA -
testcase_30 AC 127 ms
65,456 KB
testcase_31 AC 121 ms
65,428 KB
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<map>
using namespace std;
typedef long long ll;

vector<int> l(8000010), r(8000010);

int main(){
    int n;
    ll d;
    cin >> n >> d;
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= n; j++){
            l[i*i+j*j]++;
            r[4000000+i*i-j*j]++;
        }
    }
    ll ans = 0;
    for(int i = 0; i < 4000001; i++){
        ans += l[i]*r[i-d+4000000];
    }
    cout << ans << endl;
    return 0;
}
0