結果

問題 No.800 四平方定理
ユーザー Y17Y17
提出日時 2019-03-17 21:53:31
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 596 bytes
コンパイル時間 1,327 ms
コンパイル使用メモリ 152,828 KB
実行使用メモリ 168,920 KB
最終ジャッジ日時 2023-09-22 05:36:40
合計ジャッジ時間 24,646 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
9,112 KB
testcase_01 AC 16 ms
5,576 KB
testcase_02 AC 11 ms
5,588 KB
testcase_03 AC 13 ms
5,468 KB
testcase_04 AC 10 ms
4,632 KB
testcase_05 AC 12 ms
5,396 KB
testcase_06 AC 18 ms
5,984 KB
testcase_07 AC 14 ms
5,424 KB
testcase_08 AC 20 ms
6,328 KB
testcase_09 AC 16 ms
5,808 KB
testcase_10 AC 1,197 ms
58,684 KB
testcase_11 AC 1,555 ms
82,472 KB
testcase_12 AC 1,468 ms
82,584 KB
testcase_13 AC 1,451 ms
82,408 KB
testcase_14 AC 1,536 ms
82,436 KB
testcase_15 AC 1,521 ms
82,532 KB
testcase_16 AC 1,595 ms
82,816 KB
testcase_17 AC 1,580 ms
82,460 KB
testcase_18 AC 1,478 ms
82,560 KB
testcase_19 AC 1,470 ms
82,804 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 1,481 ms
82,584 KB
testcase_23 TLE -
testcase_24 TLE -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    long long n, d;
    cin >> n >> d;

    long long ans = 0;
    unordered_map<long long, long long> mp;
    unordered_set<long long> st;
    for(long long i = 1;i <= n;i++){
        for(long long j = 1;j <= n;j++){
            mp[i*i+j*j]++;
            //st.insert(i*i+j*j);
        }
    }


  	for(long long i = 1;i <= n;i++){
        for(long long j = 1;j <= n;j++){
            //if(st.find(i*i-j*j+d) != st.end()){
                ans += mp[i*i-j*j+d];
            //}
        }
    }

    cout << ans << endl;

    return 0;
}
0