結果

問題 No.781 円周上の格子点の数え上げ
ユーザー beet
提出日時 2019-01-11 21:37:30
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 650 bytes
コンパイル時間 8,317 ms
コンパイル使用メモリ 270,360 KB
最終ジャッジ日時 2025-01-06 20:18:01
ジャッジサーバーID
(参考情報)
judge2 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13 TLE * 8
権限があれば一括ダウンロードができます

ソースコード

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;

  using P = pair<Int, Int>;
  map<Int, set<P> > sp;
  
  for(Int i=0;i*i<=y;i++){
    for(Int j=0;i*i+j*j<=y;j++){
      sp[i*i+j*j].emplace(i,j);
      sp[i*i+j*j].emplace(i,-j);
      sp[i*i+j*j].emplace(-i,j);
      sp[i*i+j*j].emplace(-i,-j);
    }
  }  

  Int ans=0;
  for(Int i=x;i<=y;i++)
    chmax(ans,(Int)sp[i].size());

  cout<<ans<<endl;
  return 0;
}
0