結果

問題 No.781 円周上の格子点の数え上げ
コンテスト
ユーザー beet
提出日時 2019-01-11 21:37:30
言語 C++17(gcc12)
(gcc 12.4.0 + boost 1.89.0)
コンパイル:
g++-12 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
MLE  
実行時間 -
コード長 650 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,528 ms
コンパイル使用メモリ 217,920 KB
実行使用メモリ 529,152 KB
最終ジャッジ日時 2026-06-07 06:19:29
合計ジャッジ時間 7,153 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 8 MLE * 1 -- * 12
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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