結果

問題 No.781 円周上の格子点の数え上げ
ユーザー beetbeet
提出日時 2019-01-11 21:46:25
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 70 ms / 2,000 ms
コード長 599 bytes
コンパイル時間 2,144 ms
コンパイル使用メモリ 199,068 KB
実行使用メモリ 81,348 KB
最終ジャッジ日時 2023-08-20 05:21:47
合計ジャッジ時間 3,603 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
81,328 KB
testcase_01 AC 21 ms
81,088 KB
testcase_02 AC 20 ms
81,088 KB
testcase_03 AC 22 ms
81,172 KB
testcase_04 AC 21 ms
81,100 KB
testcase_05 AC 20 ms
81,044 KB
testcase_06 AC 21 ms
81,044 KB
testcase_07 AC 21 ms
81,104 KB
testcase_08 AC 61 ms
80,992 KB
testcase_09 AC 59 ms
81,296 KB
testcase_10 AC 21 ms
80,988 KB
testcase_11 AC 21 ms
81,348 KB
testcase_12 AC 63 ms
81,032 KB
testcase_13 AC 70 ms
81,332 KB
testcase_14 AC 23 ms
81,188 KB
testcase_15 AC 21 ms
81,160 KB
testcase_16 AC 21 ms
81,044 KB
testcase_17 AC 55 ms
81,316 KB
testcase_18 AC 49 ms
80,992 KB
testcase_19 AC 48 ms
81,300 KB
testcase_20 AC 48 ms
80,988 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 x,y;
  cin>>x>>y;

  const Int MAX = 1e7+100;
  vector<Int> cnt(MAX,0);
 
  for(Int i=0;i*i<=y;i++){
    for(Int j=0;j<=i;j++){
      if(i*i+j*j>=MAX) continue;      
      cnt[i*i+j*j]++;
      if(j!=0&&i!=j) cnt[i*i+j*j]++;
    }
  }  

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