結果
問題 | No.800 四平方定理 |
ユーザー | fine |
提出日時 | 2019-03-17 22:43:16 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 698 bytes |
コンパイル時間 | 1,360 ms |
コンパイル使用メモリ | 167,508 KB |
実行使用メモリ | 81,372 KB |
最終ジャッジ日時 | 2023-09-22 08:45:34 |
合計ジャッジ時間 | 5,792 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 28 ms
81,060 KB |
testcase_01 | AC | 27 ms
81,192 KB |
testcase_02 | AC | 28 ms
81,124 KB |
testcase_03 | AC | 29 ms
81,164 KB |
testcase_04 | AC | 34 ms
81,104 KB |
testcase_05 | AC | 28 ms
81,172 KB |
testcase_06 | AC | 29 ms
81,048 KB |
testcase_07 | AC | 29 ms
81,100 KB |
testcase_08 | AC | 28 ms
81,104 KB |
testcase_09 | AC | 29 ms
81,124 KB |
testcase_10 | AC | 45 ms
81,112 KB |
testcase_11 | AC | 47 ms
81,052 KB |
testcase_12 | AC | 48 ms
81,076 KB |
testcase_13 | AC | 44 ms
81,064 KB |
testcase_14 | AC | 44 ms
81,372 KB |
testcase_15 | AC | 48 ms
81,072 KB |
testcase_16 | AC | 48 ms
81,120 KB |
testcase_17 | AC | 47 ms
81,180 KB |
testcase_18 | AC | 49 ms
81,104 KB |
testcase_19 | AC | 53 ms
81,272 KB |
testcase_20 | AC | 28 ms
81,176 KB |
testcase_21 | AC | 28 ms
81,164 KB |
testcase_22 | AC | 49 ms
81,124 KB |
testcase_23 | RE | - |
testcase_24 | RE | - |
testcase_25 | RE | - |
testcase_26 | AC | 29 ms
81,064 KB |
testcase_27 | AC | 29 ms
81,112 KB |
testcase_28 | RE | - |
testcase_29 | RE | - |
testcase_30 | RE | - |
testcase_31 | RE | - |
testcase_32 | RE | - |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; const int MAXV = 5000000; int main() { cin.tie(0); ios::sync_with_stdio(false); int n, d; cin >> n >> d; vector<ll> cnt1(MAXV + 1, 0); for (int x = 1; x <= n; x++) { for (int y = 1; y <= n; y++) { cnt1[x * x + y * y]++; } } vector<ll> cnt2(MAXV + 1, 0); for (int w = 1; w <= n; w++) { int lim = min(n * n, w * w + d); for (int z = 1; z * z <= lim; z++) { cnt2[d + w * w - z * z]++; } } ll ans = 0; for (int i = 0; i <= MAXV; i++) { ans += cnt1[i] * cnt2[i]; } cout << ans << endl; return 0; }