結果

問題 No.781 円周上の格子点の数え上げ
ユーザー beetbeet
提出日時 2019-01-11 21:41:59
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 620 bytes
コンパイル時間 3,285 ms
コンパイル使用メモリ 203,892 KB
実行使用メモリ 333,204 KB
最終ジャッジ日時 2023-08-20 05:10:36
合計ジャッジ時間 9,310 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
237,368 KB
testcase_01 WA -
testcase_02 AC 80 ms
237,312 KB
testcase_03 AC 80 ms
237,500 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 87 ms
239,140 KB
testcase_08 WA -
testcase_09 AC 746 ms
333,204 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

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 x,y;
  cin>>x>>y;

  const Int MAX = 1e7+100;
  using P = pair<Int, Int>;
  vector<vector<P> > sp(MAX);
  
  for(Int i=0;i*i<=y;i++){
    for(Int j=0;j<i;j++){
      if(i*i+j*j>=MAX) continue;
      sp[i*i+j*j].emplace_back(i,j);
    }
  }  

  Int ans=0;
  for(Int i=x;i<=y;i++){
    chmax(ans,(Int)sp[i].size()*4);
  }
  cout<<ans<<endl;
  return 0;
}
0