結果

問題 No.781 円周上の格子点の数え上げ
ユーザー srjywrdnprktsrjywrdnprkt
提出日時 2024-02-09 18:26:32
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 505 ms / 2,000 ms
コード長 417 bytes
コンパイル時間 1,772 ms
コンパイル使用メモリ 202,928 KB
実行使用メモリ 237,688 KB
最終ジャッジ日時 2024-02-09 18:26:46
合計ジャッジ時間 11,841 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 342 ms
237,688 KB
testcase_01 AC 445 ms
237,688 KB
testcase_02 AC 345 ms
237,688 KB
testcase_03 AC 462 ms
237,688 KB
testcase_04 AC 357 ms
237,688 KB
testcase_05 AC 442 ms
237,688 KB
testcase_06 AC 352 ms
237,688 KB
testcase_07 AC 468 ms
237,688 KB
testcase_08 AC 505 ms
237,688 KB
testcase_09 AC 423 ms
237,688 KB
testcase_10 AC 349 ms
237,688 KB
testcase_11 AC 438 ms
237,688 KB
testcase_12 AC 345 ms
237,688 KB
testcase_13 AC 429 ms
237,688 KB
testcase_14 AC 368 ms
237,688 KB
testcase_15 AC 446 ms
237,688 KB
testcase_16 AC 359 ms
237,688 KB
testcase_17 AC 428 ms
237,688 KB
testcase_18 AC 349 ms
237,688 KB
testcase_19 AC 454 ms
237,688 KB
testcase_20 AC 349 ms
237,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    ll x, y, m=1e7, ans=0;
    cin >> x >> y;
    m = sqrt(m)+1;
    vector<ll> cnt(3e7);
    for (int i=-m; i<=m; ++i){
        for (int j=-m; j<=m; ++j) cnt[i*i+j*j]++;
    }

    for (int i=x; i<=y; i++) ans = max(ans, cnt[i]);

    cout << ans << endl;

    return 0;
}
0