結果
| 問題 | No.800 四平方定理 |
| コンテスト | |
| ユーザー |
le_panda_noir
|
| 提出日時 | 2020-06-13 19:37:26 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 521 bytes |
| 記録 | |
| コンパイル時間 | 613 ms |
| コンパイル使用メモリ | 99,512 KB |
| 実行使用メモリ | 140,544 KB |
| 最終ジャッジ日時 | 2026-06-10 17:40:43 |
| 合計ジャッジ時間 | 7,464 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | AC * 10 TLE * 2 -- * 18 |
ソースコード
#include <iostream>
#include <vector>
#include <map>
using namespace std;
using ll = long long;
void ins() {}
template<class T,class... Rest>void ins(T& v,Rest&... rest){cin>>v;ins(rest...);}
#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
int main() {
int N, D;
ins(N, D);
map<int, int> m, m2;
rep(i, N) rep(j, N) {
++m[(i+1)*(i+1)+(j+1)*(j+1)];
++m2[(i+1)*(i+1)-(j+1)*(j+1)];
}
ll ans = 0;
for (const auto& [wz, count]:m2) {
ans += m[wz+D] * count;
}
cout << ans << endl;
return 0;
}
le_panda_noir