結果
問題 |
No.800 四平方定理
|
ユーザー |
![]() |
提出日時 | 2019-04-07 02:02:06 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,137 bytes |
コンパイル時間 | 1,776 ms |
コンパイル使用メモリ | 173,296 KB |
実行使用メモリ | 171,480 KB |
最終ジャッジ日時 | 2024-06-25 12:51:03 |
合計ジャッジ時間 | 26,480 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 TLE * 8 |
ソースコード
#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; }