結果
| 問題 | No.781 円周上の格子点の数え上げ | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2024-04-08 10:50:27 | 
| 言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 136 ms / 2,000 ms | 
| コード長 | 739 bytes | 
| コンパイル時間 | 9,599 ms | 
| コンパイル使用メモリ | 273,800 KB | 
| 最終ジャッジ日時 | 2025-02-20 22:57:02 | 
| ジャッジサーバーID (参考情報) | judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 21 | 
ソースコード
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
#define rep(i, n) for (ll i = 0; i < (ll) (n); i++)
template<class T>
bool chmax(T& p, T q, bool C = 1) {
    if (C == 0 && p == q) {
        return 1;
    }
    if (p < q) {
        p = q;
        return 1;
    }
    else {
        return 0;
    }
}
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll X,Y;
    cin>>X>>Y;
    vll P(Y+1,0);
    ll an=0;
    for(ll x=1;x*x<=Y;x++){
        for(ll y=0;x*x+y*y<=Y;y++){
            P[x*x+y*y]+=4;
            if(x*x+y*y>=X)chmax(an,P[x*x+y*y]);
        }
    }
    cout<<an<<endl;
}
            
            
            
        