結果

問題 No.781 円周上の格子点の数え上げ
ユーザー phsplsphspls
提出日時 2020-04-17 21:48:50
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 714 bytes
コンパイル時間 1,703 ms
コンパイル使用メモリ 172,896 KB
実行使用メモリ 179,836 KB
最終ジャッジ日時 2024-04-14 13:27:36
合計ジャッジ時間 5,635 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
6,948 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 1 ms
6,944 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 12 ms
6,944 KB
testcase_09 AC 13 ms
6,940 KB
testcase_10 AC 6 ms
6,944 KB
testcase_11 AC 11 ms
6,940 KB
testcase_12 TLE -
testcase_13 -- -
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;
    for(int i: lens) {
        for(int j: lens) {
            if(j==0) continue;
            int val = i+j;
            if(val < x || y < val) continue;
            if(cands.find(val) == cands.end()) cands[val] = 1;
            else cands[val] += 1;
        }
    }
    
    int result = 0;
    for(pair<int, int> p: cands) {
        result = max(result, p.second);
    }

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