結果

問題 No.781 円周上の格子点の数え上げ
ユーザー snrnsidysnrnsidy
提出日時 2021-04-13 23:28:13
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 143 ms / 2,000 ms
コード長 810 bytes
コンパイル時間 2,341 ms
コンパイル使用メモリ 206,772 KB
実行使用メモリ 81,760 KB
最終ジャッジ日時 2023-09-12 13:59:03
合計ジャッジ時間 6,315 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
81,500 KB
testcase_01 AC 131 ms
81,496 KB
testcase_02 AC 130 ms
81,512 KB
testcase_03 AC 130 ms
81,440 KB
testcase_04 AC 129 ms
81,436 KB
testcase_05 AC 129 ms
81,516 KB
testcase_06 AC 132 ms
81,756 KB
testcase_07 AC 131 ms
81,492 KB
testcase_08 AC 132 ms
81,736 KB
testcase_09 AC 129 ms
81,464 KB
testcase_10 AC 130 ms
81,460 KB
testcase_11 AC 131 ms
81,500 KB
testcase_12 AC 136 ms
81,460 KB
testcase_13 AC 143 ms
81,464 KB
testcase_14 AC 132 ms
81,760 KB
testcase_15 AC 134 ms
81,492 KB
testcase_16 AC 132 ms
81,564 KB
testcase_17 AC 137 ms
81,468 KB
testcase_18 AC 132 ms
81,440 KB
testcase_19 AC 134 ms
81,568 KB
testcase_20 AC 131 ms
81,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("O3")
#include <bits/stdc++.h>
 
using namespace std;

long long int cnt[10000001];

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

    long long int X,Y;
    long long int res = 0;

    cin >> X >> Y;

    for(long long int a=0;a<=3162;a++)
    {
        for(long long int b=0;b<=3162;b++)
        {
            long long int R = a*a + b*b;
            if(R <= 10000000)
            {
                long long int val = 1;
                if(a!=0)
                {
                    val*=2;
                }
                if(b!=0)
                {
                    val*=2;
                }
                cnt[R]+=val;
            }
        }
    }

    for(int R=X;R<=Y;R++)
    {
        res = max(res,cnt[R]);
    }

    cout << res << '\n';
    
	return 0;
}
0