結果

問題 No.800 四平方定理
ユーザー beetbeet
提出日時 2019-03-17 22:51:11
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 541 bytes
コンパイル時間 1,952 ms
コンパイル使用メモリ 207,052 KB
実行使用メモリ 164,756 KB
最終ジャッジ日時 2023-09-22 09:07:07
合計ジャッジ時間 27,126 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
4,472 KB
testcase_01 AC 13 ms
5,736 KB
testcase_02 AC 11 ms
5,764 KB
testcase_03 AC 11 ms
5,368 KB
testcase_04 AC 9 ms
4,732 KB
testcase_05 AC 11 ms
5,452 KB
testcase_06 AC 16 ms
6,024 KB
testcase_07 AC 12 ms
5,368 KB
testcase_08 AC 17 ms
6,260 KB
testcase_09 AC 14 ms
5,624 KB
testcase_10 AC 639 ms
58,668 KB
testcase_11 AC 898 ms
82,412 KB
testcase_12 AC 871 ms
82,404 KB
testcase_13 AC 832 ms
82,460 KB
testcase_14 AC 919 ms
82,552 KB
testcase_15 AC 882 ms
82,604 KB
testcase_16 AC 956 ms
82,428 KB
testcase_17 AC 909 ms
82,468 KB
testcase_18 AC 821 ms
82,600 KB
testcase_19 AC 901 ms
82,596 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 844 ms
82,544 KB
testcase_23 AC 1,659 ms
114,452 KB
testcase_24 AC 1,974 ms
164,480 KB
testcase_25 AC 1,660 ms
112,672 KB
testcase_26 AC 1 ms
4,380 KB
testcase_27 AC 1 ms
4,380 KB
testcase_28 TLE -
testcase_29 TLE -
testcase_30 AC 1,657 ms
117,188 KB
testcase_31 AC 1,540 ms
112,704 KB
testcase_32 AC 1,701 ms
116,372 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;}


//INSERT ABOVE HERE
signed main(){
  Int n,d;
  cin>>n>>d;
  unordered_map<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