結果

問題 No.800 四平方定理
ユーザー BantakoBantako
提出日時 2019-03-17 21:27:03
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 454 bytes
コンパイル時間 1,595 ms
コンパイル使用メモリ 171,520 KB
実行使用メモリ 94,824 KB
最終ジャッジ日時 2023-09-22 03:40:13
合計ジャッジ時間 29,646 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
4,380 KB
testcase_01 AC 12 ms
5,468 KB
testcase_02 AC 8 ms
4,504 KB
testcase_03 AC 9 ms
4,524 KB
testcase_04 AC 8 ms
4,464 KB
testcase_05 AC 9 ms
4,440 KB
testcase_06 AC 14 ms
5,384 KB
testcase_07 AC 15 ms
5,440 KB
testcase_08 AC 20 ms
6,284 KB
testcase_09 AC 10 ms
4,652 KB
testcase_10 AC 894 ms
48,552 KB
testcase_11 AC 974 ms
52,296 KB
testcase_12 AC 1,070 ms
54,216 KB
testcase_13 AC 784 ms
44,320 KB
testcase_14 AC 894 ms
49,928 KB
testcase_15 AC 1,019 ms
53,424 KB
testcase_16 AC 908 ms
50,176 KB
testcase_17 AC 876 ms
48,440 KB
testcase_18 AC 1,195 ms
58,840 KB
testcase_19 AC 1,380 ms
82,604 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 1,217 ms
56,728 KB
testcase_23 TLE -
testcase_24 AC 1,856 ms
89,052 KB
testcase_25 TLE -
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 1 ms
4,380 KB
testcase_28 AC 1,790 ms
89,064 KB
testcase_29 TLE -
testcase_30 AC 1,774 ms
86,256 KB
testcase_31 AC 1,691 ms
84,184 KB
testcase_32 AC 1,864 ms
87,192 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:7:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
    7 | 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;
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;
        mp[i * i - j * j + D]++;
    }
    ll ans = 0;
    rep(i,1,N+1)rep(j,1,N+1){
        ans += mp[i * i + j * j];
    }
    cout << ans << endl;
}
0