結果

問題 No.781 円周上の格子点の数え上げ
ユーザー rlangevinrlangevin
提出日時 2023-01-12 22:31:23
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 820 bytes
コンパイル時間 5,646 ms
コンパイル使用メモリ 310,924 KB
実行使用メモリ 8,760 KB
最終ジャッジ日時 2023-08-25 02:59:29
合計ジャッジ時間 10,170 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
8,756 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,384 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 10 ms
4,380 KB
testcase_09 AC 11 ms
4,380 KB
testcase_10 AC 4 ms
4,376 KB
testcase_11 AC 7 ms
4,376 KB
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using P = pair<int, int>;
using mint = modint998244353;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main()
{
    int X, Y;
    cin >> X >> Y;
    int i = 1;
    map<int, int> mp;
    vector<int> L;
    while (i * i <= Y)
    {
        L.push_back(i * i);
        mp[i * i] += 1;
        i += 1;
    }
    for (int a : L)
    {
        for (int b : L)
        {
            if (X <= a + b && a + b <= Y)
            {
                mp[a + b] += 1;
            }
        }
    }

    int ans = 0;
    for (P p : mp)
    {
        int k = p.first;
        int v = p.second;
        if (X <= k && k <= Y)
        {
            ans = max(ans, v);
        }
    }
    cout << ans * 4 << endl;
}
0