結果

問題 No.781 円周上の格子点の数え上げ
ユーザー kappybarkappybar
提出日時 2020-04-13 14:41:37
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 276 ms / 2,000 ms
コード長 739 bytes
コンパイル時間 1,776 ms
コンパイル使用メモリ 171,012 KB
実行使用メモリ 81,616 KB
最終ジャッジ日時 2023-10-25 03:49:06
合計ジャッジ時間 4,738 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 4 ms
4,348 KB
testcase_08 AC 273 ms
81,616 KB
testcase_09 AC 269 ms
81,616 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 3 ms
4,348 KB
testcase_12 AC 275 ms
81,616 KB
testcase_13 AC 276 ms
81,616 KB
testcase_14 AC 10 ms
7,768 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 153 ms
49,704 KB
testcase_18 AC 146 ms
49,704 KB
testcase_19 AC 152 ms
51,220 KB
testcase_20 AC 154 ms
51,220 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
using ll =  long long ;
using P = pair<int,int> ;
const ll INF = 1e18;
const int MOD = 1000000007;

int main(){
    int x,y;
    cin >> x >> y;
    vector<int> square;
    vector<ll> cnt(y+1,0);
    for(int i=0;i*i<=y;i++){
        if(i==0) square.push_back(i * i);
        else{
            square.push_back(i * i);
            square.push_back(i * i);
        }
    }

    rep(i,square.size()){
        rep(j,square.size()){
            if(square[i]+square[j] > y) continue;
            cnt[square[i]+square[j]] ++;
        }
    }

    ll ans = 0;
    for(int i=x;i<=y;i++){
        ans = max(ans,cnt[i]);
    }
    cout << ans << endl;
    return 0;
}
0