結果

問題 No.2406 Difference of Coordinate Squared
ユーザー 👑 amentorimaruamentorimaru
提出日時 2023-07-01 04:14:25
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 803 bytes
コンパイル時間 4,002 ms
コンパイル使用メモリ 121,424 KB
実行使用メモリ 7,104 KB
最終ジャッジ日時 2023-10-19 00:13:56
合計ジャッジ時間 5,451 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 2 ms
4,348 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 11 ms
5,804 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 12 ms
6,332 KB
testcase_12 AC 17 ms
6,596 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 14 ms
6,596 KB
testcase_20 AC 15 ms
6,860 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 2 ms
4,348 KB
testcase_29 AC 2 ms
4,348 KB
testcase_30 AC 1 ms
4,348 KB
testcase_31 AC 1 ms
4,348 KB
testcase_32 AC 2 ms
4,348 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 2 ms
4,348 KB
testcase_38 AC 1 ms
4,348 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 2 ms
4,348 KB
testcase_42 WA -
testcase_43 AC 2 ms
4,348 KB
testcase_44 AC 2 ms
4,348 KB
testcase_45 WA -
testcase_46 AC 2 ms
4,348 KB
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 AC 1 ms
4,348 KB
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 AC 1 ms
4,348 KB
testcase_55 AC 2 ms
4,348 KB
testcase_56 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <math.h>
#include <atcoder/modint.hpp>

using namespace std;
using namespace atcoder;
using ll = long long;
using mint = modint998244353;

int main() {
  ll n, m;
  cin >> n >> m;
  mint ans = 0;
  vector<mint> f(n + 1, 1);
  for (ll i = 0; i < n; i++)
    f[i + 1] = f[i] * (i + 1);
  for (ll y = 0; y < n; y++) {
    ll x2 = y * y + m;
    ll x = sqrt(x2) - 2;
    while (x * x - y * y < m)
      x++;
    if (x * x - y * y != m)
      continue;
    if ((n - x - y) % 2)
      continue;
    ll a = abs(n - x + y) / 2;
    ll b = abs(n - x - y) / 2;
    mint tmp = f[n] * f[n] / (f[a] * f[n - a] * f[b] * f[n - b]);
    if (y)
      tmp *= 4;
    else
      tmp *= 2;
    ans += tmp;
  }
  ans /= mint(4).pow(n);
  cout << ans.val() << "\n";
  return 0;
}
0