結果

問題 No.781 円周上の格子点の数え上げ
ユーザー phsplsphspls
提出日時 2020-04-17 22:26:22
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 821 bytes
コンパイル時間 1,749 ms
コンパイル使用メモリ 172,644 KB
実行使用メモリ 92,448 KB
最終ジャッジ日時 2024-04-14 14:42:39
合計ジャッジ時間 7,528 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
13,756 KB
testcase_01 AC 2 ms
6,812 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 5 ms
6,940 KB
testcase_09 AC 5 ms
6,940 KB
testcase_10 AC 4 ms
6,940 KB
testcase_11 AC 7 ms
6,940 KB
testcase_12 AC 1,955 ms
53,120 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
    int x, y;
    cin >> x >> y;
    vector<int> lens;
    for(int i=0; i<=y; i++) {
        if(i*i > y) break;
        lens.push_back(i*i);
    }
    map<int, int> cands;
    rep(a, lens.size()) {
        int i = lens[a];
        for(int b=a; b<lens.size(); b++) {
            int j = lens[b];
            int val = i+j;
            if(val < x) continue;
            if(y < val) break;
            int adder = i == j || i == 0 ? 1 : 2;
            if(cands.count(val)) cands[val] += adder;
            else cands[val] = adder;
        }
    }
    
    int result = 0;
    for(pair<int, int> p: cands) {
        result = max(result, p.second);
    }

    cout << 4 * result << "\n";
}
0