結果

問題 No.800 四平方定理
ユーザー akun0716akun0716
提出日時 2019-03-17 22:52:56
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,234 bytes
コンパイル時間 912 ms
コンパイル使用メモリ 79,004 KB
実行使用メモリ 140,684 KB
最終ジャッジ日時 2023-09-22 09:10:26
合計ジャッジ時間 33,083 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
5,536 KB
testcase_01 AC 30 ms
7,244 KB
testcase_02 AC 19 ms
5,960 KB
testcase_03 AC 23 ms
6,516 KB
testcase_04 AC 19 ms
5,920 KB
testcase_05 AC 23 ms
6,404 KB
testcase_06 AC 38 ms
8,036 KB
testcase_07 AC 25 ms
6,820 KB
testcase_08 AC 35 ms
8,560 KB
testcase_09 AC 30 ms
7,356 KB
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 TLE -
testcase_23 TLE -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));



signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N, D;
	cin >> N >> D;
	map<int, int>A;
	map<int, int>B;
	int ans = 0;
	eFOR(i, 1, N) {
		eFOR(j, i, N) {
			B[i*i + j * j]+=2;
			if (i == j) B[i*i + j * j]--;
		}
	}
	eFOR(i, 1, N) {
		eFOR(j, 1, N) {
			ans += B[D + i*i - j * j];
			//ans+=A[D-(i*i - j * j)];
		}
	}
	cout << ans << endl;
	return 0;
}

0