結果

問題 No.781 円周上の格子点の数え上げ
ユーザー peroonperoon
提出日時 2019-06-08 21:15:23
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 187 ms / 2,000 ms
コード長 957 bytes
コンパイル時間 1,668 ms
コンパイル使用メモリ 162,564 KB
実行使用メモリ 81,664 KB
最終ジャッジ日時 2024-04-15 20:01:42
合計ジャッジ時間 2,856 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
5,248 KB
testcase_01 AC 17 ms
5,376 KB
testcase_02 AC 17 ms
5,376 KB
testcase_03 AC 17 ms
5,376 KB
testcase_04 AC 17 ms
5,376 KB
testcase_05 AC 18 ms
5,376 KB
testcase_06 AC 18 ms
5,376 KB
testcase_07 AC 18 ms
5,376 KB
testcase_08 AC 11 ms
5,376 KB
testcase_09 AC 11 ms
5,376 KB
testcase_10 AC 18 ms
5,376 KB
testcase_11 AC 18 ms
5,376 KB
testcase_12 AC 100 ms
46,336 KB
testcase_13 AC 187 ms
81,664 KB
testcase_14 AC 18 ms
5,376 KB
testcase_15 AC 16 ms
5,376 KB
testcase_16 AC 17 ms
5,376 KB
testcase_17 AC 106 ms
49,792 KB
testcase_18 AC 13 ms
5,376 KB
testcase_19 AC 13 ms
5,376 KB
testcase_20 AC 13 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll = long long;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

const ll mod = 1e9 + 7;
const ll inf = 1e18;

ll F[10000010];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    // input
    ll X, Y;
    cin >> X >> Y;

    FOR(x, 1, 3200){
        FOR(y, 0, 3200){
            ll R = x*x + y*y;
            if(X<=R && R<=Y){
                F[R]++;
            }
        }
    }

    ll ma = 0;
    FOR(i, X, Y+1){
        chmax(ma, F[i]);
    }

    p(ma * 4);
    
    return 0;
}
0