結果

問題 No.800 四平方定理
ユーザー yumarimoyumarimo
提出日時 2019-04-07 02:02:48
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,127 bytes
コンパイル時間 1,685 ms
コンパイル使用メモリ 171,856 KB
実行使用メモリ 92,396 KB
最終ジャッジ日時 2023-09-07 19:05:19
合計ジャッジ時間 6,045 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
9,884 KB
testcase_01 AC 33 ms
7,256 KB
testcase_02 AC 21 ms
6,008 KB
testcase_03 AC 25 ms
6,548 KB
testcase_04 AC 21 ms
6,204 KB
testcase_05 AC 24 ms
6,352 KB
testcase_06 AC 41 ms
8,336 KB
testcase_07 AC 31 ms
7,056 KB
testcase_08 AC 42 ms
8,328 KB
testcase_09 AC 34 ms
7,344 KB
testcase_10 TLE -
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define llong long long int
#define ldouble long double
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, k, n) for (int i = k; i < n; ++i)
#define fore(i,a) for (auto &i : a)
#define repr(i, n) for (int i = n; i >= 0; --i)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()

const static int mod = 1000000000 + 7;
const static int inf = INT_MAX / 2;
const static llong INF = LLONG_MAX / 2;
const static double eps = 1e-10;
const static int dx[] = {1, 0, -1, 0};
const static int dy[] = {0, 1, 0, -1};

signed main (int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    llong n, d;
    cin >> n >> d;

    map<llong, int> M;
    for (llong x = 1; x <= n; ++x) {
        for (llong y = 1; y <= n; ++y) {
            ++M[x * x + y * y];
        }
    }

    llong res = 0;
    for (llong z = 1; z <= n; ++z) {
        for (llong w = 1; w <= n; ++w) {
            res += M[w * w - z * z + d];
        }
    }

    cout << res << endl;

    return 0;
}
0