結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
5,252 KB
testcase_01 AC 14 ms
5,640 KB
testcase_02 AC 11 ms
5,408 KB
testcase_03 AC 12 ms
5,552 KB
testcase_04 AC 9 ms
4,668 KB
testcase_05 AC 12 ms
5,476 KB
testcase_06 AC 18 ms
5,976 KB
testcase_07 AC 14 ms
5,564 KB
testcase_08 AC 19 ms
6,300 KB
testcase_09 AC 15 ms
5,620 KB
testcase_10 AC 1,017 ms
58,628 KB
testcase_11 AC 1,290 ms
82,620 KB
testcase_12 AC 1,221 ms
82,712 KB
testcase_13 AC 1,157 ms
82,764 KB
testcase_14 AC 1,274 ms
82,448 KB
testcase_15 AC 1,325 ms
82,580 KB
testcase_16 AC 1,385 ms
82,548 KB
testcase_17 AC 1,296 ms
82,636 KB
testcase_18 AC 1,223 ms
82,620 KB
testcase_19 AC 1,239 ms
82,528 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 1,257 ms
82,420 KB
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 2 ms
4,380 KB
testcase_28 TLE -
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
testcase_32 TLE -
権限があれば一括ダウンロードができます

ソースコード

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;

    unordered_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