結果
| 問題 | No.800 四平方定理 |
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2026-03-10 18:22:50 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 849 bytes |
| 記録 | |
| コンパイル時間 | 2,147 ms |
| コンパイル使用メモリ | 341,644 KB |
| 実行使用メモリ | 265,344 KB |
| 最終ジャッジ日時 | 2026-03-10 18:23:45 |
| 合計ジャッジ時間 | 53,639 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 TLE * 1 |
| other | AC * 12 TLE * 18 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail>
void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }
#define dbg(...) cerr << "(" << #__VA_ARGS__ << ")", dbg_out(__VA_ARGS__)
#define int long long
const int MOD = 1e9 + 7;
const int INF = LLONG_MAX >> 1;
void solve() {
int n, d; cin >> n >> d;
map<int, int> mp;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
mp[i * i - j * j]++;
}
}
int ans = 0;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
ans += mp[d - i * i - j * j];
}
}
cout << ans << '\n';
}
int32_t main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int tc = 1;
// cin >> tc;
while (tc--) solve();
}
vjudge1