結果

問題 No.781 円周上の格子点の数え上げ
ユーザー tonnnura172tonnnura172
提出日時 2020-04-17 17:26:44
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 100 ms / 2,000 ms
コード長 574 bytes
コンパイル時間 1,564 ms
コンパイル使用メモリ 165,184 KB
実行使用メモリ 81,504 KB
最終ジャッジ日時 2024-04-14 12:42:52
合計ジャッジ時間 3,188 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 3 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 3 ms
6,944 KB
testcase_07 AC 3 ms
6,944 KB
testcase_08 AC 92 ms
81,332 KB
testcase_09 AC 92 ms
81,308 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 AC 96 ms
81,504 KB
testcase_13 AC 100 ms
81,420 KB
testcase_14 AC 6 ms
7,728 KB
testcase_15 AC 3 ms
6,944 KB
testcase_16 AC 2 ms
6,940 KB
testcase_17 AC 54 ms
49,508 KB
testcase_18 AC 50 ms
49,516 KB
testcase_19 AC 51 ms
51,036 KB
testcase_20 AC 53 ms
51,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

int main(){
    int X, Y;
    cin >> X >> Y;

    int upper = sqrt(Y)+1;
    int c;
    vector<int> r(2*Y+1);
    rep(a, upper){
        for (int b=a; b < upper; b++){
            c = a*a+b*b;
            if (a==0 || a==b) {
                r[c] += 4;
            }
            else{
                r[c] += 8;
            }
        }
    }
    int ans = 0;
    for (int x=X;x<Y+1;x++) {
        ans = max(ans, r[x]);
    }
    cout << ans << endl;
}
0