結果
問題 |
No.781 円周上の格子点の数え上げ
|
ユーザー |
![]() |
提出日時 | 2019-01-11 21:38:26 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 107 ms / 2,000 ms |
コード長 | 806 bytes |
コンパイル時間 | 1,600 ms |
コンパイル使用メモリ | 167,964 KB |
実行使用メモリ | 42,316 KB |
最終ジャッジ日時 | 2024-11-30 04:50:28 |
合計ジャッジ時間 | 4,324 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 |
ソースコード
#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'; }