結果

問題 No.781 円周上の格子点の数え上げ
ユーザー risujirohrisujiroh
提出日時 2019-01-11 21:38:26
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 83 ms / 2,000 ms
コード長 806 bytes
コンパイル時間 1,460 ms
コンパイル使用メモリ 168,844 KB
実行使用メモリ 42,340 KB
最終ジャッジ日時 2024-05-07 12:12:32
合計ジャッジ時間 3,865 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
42,100 KB
testcase_01 AC 78 ms
42,288 KB
testcase_02 AC 72 ms
42,172 KB
testcase_03 AC 77 ms
42,168 KB
testcase_04 AC 72 ms
42,280 KB
testcase_05 AC 76 ms
42,244 KB
testcase_06 AC 79 ms
42,268 KB
testcase_07 AC 73 ms
42,100 KB
testcase_08 AC 74 ms
42,332 KB
testcase_09 AC 80 ms
42,128 KB
testcase_10 AC 71 ms
42,304 KB
testcase_11 AC 73 ms
42,248 KB
testcase_12 AC 78 ms
42,308 KB
testcase_13 AC 83 ms
42,100 KB
testcase_14 AC 75 ms
42,272 KB
testcase_15 AC 79 ms
42,108 KB
testcase_16 AC 77 ms
42,304 KB
testcase_17 AC 83 ms
42,284 KB
testcase_18 AC 74 ms
42,340 KB
testcase_19 AC 77 ms
42,264 KB
testcase_20 AC 83 ms
42,260 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using lint = long long int;
using ulint = unsigned long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T, class U> void assign(V<T>& v, int n, const U& a) { v.assign(n, a); }
template<class T, class... Args> void assign(V<T>& v, int n, const Args&... args) { v.resize(n); for (auto&& e : v) assign(e, args...); }


int main() {
  cin.tie(nullptr); ios_base::sync_with_stdio(false);
  int x, y; cin >> x >> y;
  int N = 1e7;
  V<> a(N + 1);
  for (int i = 1; i < 3200; ++i) for (int j = 0; j < 3200; ++j) if (i * i + j * j <= N) {
    ++a[i * i + j * j];
  }
  int res = 0;
  for (int i = x; i <= y; ++i) {
    res = max(res, a[i]);
  }
  cout << 4 * res << '\n';
}
0