結果

問題 No.800 四平方定理
ユーザー beetbeet
提出日時 2019-03-17 21:26:41
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 680 bytes
コンパイル時間 2,798 ms
コンパイル使用メモリ 226,524 KB
実行使用メモリ 167,192 KB
最終ジャッジ日時 2023-09-22 03:37:30
合計ジャッジ時間 25,519 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
5,544 KB
testcase_01 AC 12 ms
6,100 KB
testcase_02 AC 10 ms
5,932 KB
testcase_03 AC 11 ms
6,368 KB
testcase_04 AC 9 ms
5,608 KB
testcase_05 AC 10 ms
5,736 KB
testcase_06 AC 17 ms
8,212 KB
testcase_07 AC 11 ms
5,872 KB
testcase_08 AC 17 ms
8,056 KB
testcase_09 AC 12 ms
5,936 KB
testcase_10 AC 628 ms
85,060 KB
testcase_11 AC 686 ms
88,068 KB
testcase_12 AC 680 ms
86,188 KB
testcase_13 AC 654 ms
85,048 KB
testcase_14 AC 721 ms
88,804 KB
testcase_15 AC 675 ms
85,972 KB
testcase_16 AC 741 ms
89,276 KB
testcase_17 AC 726 ms
87,540 KB
testcase_18 AC 720 ms
87,972 KB
testcase_19 AC 717 ms
88,572 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 1,106 ms
85,588 KB
testcase_23 TLE -
testcase_24 AC 1,532 ms
167,004 KB
testcase_25 AC 1,508 ms
166,896 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 1 ms
4,380 KB
testcase_28 AC 1,532 ms
167,192 KB
testcase_29 AC 1,530 ms
166,904 KB
testcase_30 AC 1,498 ms
167,136 KB
testcase_31 AC 1,392 ms
167,144 KB
testcase_32 AC 1,500 ms
167,004 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<typename T,typename U> 
using gmap = cc_hash_table<T, U, hash<T> >;

//INSERT ABOVE HERE

signed main(){
  int n,d;
  cin>>n>>d;
  gmap<int, int> cnt;
  for(int i=1;i<=n;i++)
    for(int j=1;j<=n;j++)
      cnt[i*i+j*j]++;
  
  int ans=0;
  for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){
      int v=i*i-j*j+d;
      ans+=cnt[v];
    }
  }
  cout<<ans<<endl;
  return 0;
}
0