結果

問題 No.781 円周上の格子点の数え上げ
コンテスト
ユーザー MASATO338
提出日時 2020-08-15 10:49:05
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 96 ms / 2,000 ms
コード長 525 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,589 ms
コンパイル使用メモリ 180,580 KB
実行使用メモリ 42,624 KB
最終ジャッジ日時 2026-04-26 20:02:38
合計ジャッジ時間 3,853 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>

using ll = long long;
using namespace std;
const int INFint = 1e9+1;
const ll INFll = (ll)1e18+1;
ll MOD=1e9+7;


int cnt[10000001] = {0};
int main(){
  ll x,y;
  cin>>x>>y;
  for(int i(0);i<4000;i++){
    for(int j(0);j<4000;j++){
      ll x = i*i+j*j;
      if(x <= 10000000){
        cnt[x]++;
      }
    }
  }
  int ans(0);
  for(int i(x);i<=y;i++){
    if((int)sqrt(i)*(int)sqrt(i) == i) ans = max(ans,(cnt[i]-1)*4);
    else ans = max(ans,cnt[i]*4);
  }
  cout << ans << endl;
  return 0;
}

0