結果

問題 No.800 四平方定理
ユーザー BantakoBantako
提出日時 2019-03-17 21:30:18
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 93 ms / 2,000 ms
コード長 483 bytes
コンパイル時間 1,635 ms
コンパイル使用メモリ 166,740 KB
実行使用メモリ 42,568 KB
最終ジャッジ日時 2023-09-22 03:53:06
合計ジャッジ時間 4,352 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 3 ms
4,376 KB
testcase_03 AC 3 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 3 ms
4,380 KB
testcase_07 AC 3 ms
4,404 KB
testcase_08 AC 4 ms
6,080 KB
testcase_09 AC 3 ms
4,380 KB
testcase_10 AC 37 ms
22,512 KB
testcase_11 AC 41 ms
22,628 KB
testcase_12 AC 40 ms
25,060 KB
testcase_13 AC 30 ms
19,712 KB
testcase_14 AC 32 ms
20,772 KB
testcase_15 AC 44 ms
24,808 KB
testcase_16 AC 34 ms
20,916 KB
testcase_17 AC 34 ms
20,984 KB
testcase_18 AC 51 ms
28,656 KB
testcase_19 AC 50 ms
28,996 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 48 ms
29,000 KB
testcase_23 AC 93 ms
42,568 KB
testcase_24 AC 72 ms
34,900 KB
testcase_25 AC 87 ms
42,308 KB
testcase_26 AC 2 ms
4,384 KB
testcase_27 AC 2 ms
5,060 KB
testcase_28 AC 71 ms
34,552 KB
testcase_29 AC 80 ms
38,484 KB
testcase_30 AC 72 ms
34,632 KB
testcase_31 AC 66 ms
32,396 KB
testcase_32 AC 75 ms
35,480 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:8:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
    8 | main(){
      | ^~~~

ソースコード

diff #

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
ll cnt[4001*4001+1000000];
main(){
    ll N,D;
    cin >> N >> D;
    unordered_map<ll,int> mp;
    rep(i,1,N+1)rep(j,1,N+1){
        if(i * i - j * j + D < 1)continue;
        cnt[i * i - j * j + D]++;
    }
    ll ans = 0;
    rep(i,1,N+1)rep(j,1,N+1){
        ans += cnt[i * i + j * j];
    }
    cout << ans << endl;
}
0