結果

問題 No.800 四平方定理
ユーザー face4face4
提出日時 2019-03-17 22:00:42
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 471 bytes
コンパイル時間 704 ms
コンパイル使用メモリ 72,632 KB
実行使用メモリ 65,588 KB
最終ジャッジ日時 2023-09-22 06:03:08
合計ジャッジ時間 4,296 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
65,468 KB
testcase_01 AC 24 ms
65,536 KB
testcase_02 AC 24 ms
65,464 KB
testcase_03 AC 23 ms
65,344 KB
testcase_04 AC 22 ms
65,480 KB
testcase_05 AC 24 ms
65,524 KB
testcase_06 AC 24 ms
65,328 KB
testcase_07 AC 24 ms
65,260 KB
testcase_08 AC 25 ms
65,304 KB
testcase_09 AC 25 ms
65,480 KB
testcase_10 AC 67 ms
65,304 KB
testcase_11 AC 72 ms
65,472 KB
testcase_12 AC 72 ms
65,548 KB
testcase_13 AC 71 ms
65,364 KB
testcase_14 AC 74 ms
65,256 KB
testcase_15 AC 69 ms
65,432 KB
testcase_16 AC 71 ms
65,548 KB
testcase_17 AC 71 ms
65,484 KB
testcase_18 AC 72 ms
65,520 KB
testcase_19 AC 72 ms
65,412 KB
testcase_20 AC 23 ms
65,256 KB
testcase_21 AC 23 ms
65,320 KB
testcase_22 AC 70 ms
65,492 KB
testcase_23 WA -
testcase_24 AC 120 ms
65,520 KB
testcase_25 WA -
testcase_26 AC 23 ms
65,528 KB
testcase_27 AC 23 ms
65,304 KB
testcase_28 AC 121 ms
65,416 KB
testcase_29 WA -
testcase_30 AC 123 ms
65,256 KB
testcase_31 AC 111 ms
65,296 KB
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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

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