結果

問題 No.800 四平方定理
ユーザー izryt(趣味)izryt(趣味)
提出日時 2020-05-24 09:27:07
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,210 bytes
コンパイル時間 867 ms
コンパイル使用メモリ 102,364 KB
実行使用メモリ 164,736 KB
最終ジャッジ日時 2024-04-19 06:31:06
合計ジャッジ時間 35,618 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
6,816 KB
testcase_01 AC 14 ms
6,944 KB
testcase_02 AC 11 ms
6,944 KB
testcase_03 AC 12 ms
6,940 KB
testcase_04 AC 10 ms
6,940 KB
testcase_05 AC 12 ms
6,940 KB
testcase_06 AC 16 ms
6,940 KB
testcase_07 AC 13 ms
6,940 KB
testcase_08 AC 17 ms
6,940 KB
testcase_09 AC 15 ms
6,940 KB
testcase_10 AC 950 ms
59,000 KB
testcase_11 AC 1,284 ms
82,848 KB
testcase_12 AC 1,260 ms
82,756 KB
testcase_13 AC 1,239 ms
82,888 KB
testcase_14 AC 1,284 ms
82,892 KB
testcase_15 AC 1,260 ms
82,748 KB
testcase_16 AC 1,263 ms
82,664 KB
testcase_17 AC 1,297 ms
82,688 KB
testcase_18 AC 1,283 ms
82,732 KB
testcase_19 AC 1,275 ms
82,784 KB
testcase_20 AC 2 ms
6,940 KB
testcase_21 AC 2 ms
6,940 KB
testcase_22 AC 1,305 ms
82,684 KB
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 AC 2 ms
6,944 KB
testcase_27 AC 2 ms
6,940 KB
testcase_28 TLE -
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
testcase_32 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <functional>
#include <climits>
#include <cstring>
#include <unordered_map>

using namespace std;

//#define int long long
#define rep(i, n) for (int i=0;i<(int)(n);++i)
#define rep1(i, n) for (int i=1;i<=(int)(n);++i)
#define range(i, l, r) for (int i=l;i<(int)(r);++i)
#define rrange(i, l, r) for (int i=r-1;i>=(int)(l);--i)
#define unless(a) if(!(a))
#define all(a) begin(a),end(a)
#define fst first
#define scd second
#define PB emplace_back
#define PPB pop_back

using vi=vector<int>;
using pii=pair<int, int>;
using ll=long long;

bool chmin(int&a,int b){return a>b?(a=b,true):false;}
bool chmax(int&a,int b){return a<b?(a=b,true):false;}
//int read(){int a;scanf("%lld",&a);return a;}

const int inf = 1e9 + 10;
const int mod = 1e9 + 7;

int N, D;
int xy[8000800];
unordered_map<int, int> zw;

signed main()
{
	cin >> N >> D;

	range(z, 1, N + 1) {
		range(w, 1, N + 1) {
			zw[z * z - w * w]++;
		}
	}

	ll ans = 0;

	range(x, 1, N + 1) {
		range(y, 1, N + 1) {
			ans += zw[D - (x * x + y * y)];
		}
	}

	printf("%lld\n", ans);
}

0