結果

問題 No.1409 Simple Math in yukicoder
ユーザー m_tsubasam_tsubasa
提出日時 2021-02-26 22:44:52
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,407 bytes
コンパイル時間 2,276 ms
コンパイル使用メモリ 199,616 KB
実行使用メモリ 10,400 KB
最終ジャッジ日時 2024-04-10 13:28:19
合計ジャッジ時間 57,336 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
10,016 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 1 ms
6,944 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 493 ms
6,940 KB
testcase_08 AC 1,685 ms
6,940 KB
testcase_09 AC 436 ms
6,944 KB
testcase_10 AC 1,346 ms
6,944 KB
testcase_11 AC 1,661 ms
6,940 KB
testcase_12 AC 1,259 ms
6,940 KB
testcase_13 AC 491 ms
6,944 KB
testcase_14 AC 380 ms
6,940 KB
testcase_15 AC 582 ms
6,944 KB
testcase_16 AC 614 ms
6,940 KB
testcase_17 TLE -
testcase_18 AC 1,096 ms
6,944 KB
testcase_19 AC 1,171 ms
6,944 KB
testcase_20 AC 950 ms
6,944 KB
testcase_21 AC 750 ms
6,940 KB
testcase_22 AC 1,410 ms
6,944 KB
testcase_23 AC 294 ms
6,940 KB
testcase_24 AC 229 ms
6,940 KB
testcase_25 AC 1,363 ms
6,944 KB
testcase_26 AC 1,508 ms
6,944 KB
testcase_27 TLE -
testcase_28 TLE -
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
testcase_32 TLE -
testcase_33 TLE -
testcase_34 TLE -
testcase_35 TLE -
testcase_36 TLE -
testcase_37 TLE -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
testcase_58 -- -
testcase_59 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

vector<int> fact(int p) {
  vector<int> res;
  for (int i = 2; i * i <= p; ++i) {
    res.push_back(i);
    while (p % i == 0) p /= i;
  }
  if (p > 1) res.push_back(p);
  return res;
}

long long modpow(long long b, long long x, long long mod) {
  long long res = 1;
  while (x) {
    if (x & 1) (res *= b) %= mod;
    (b *= b) %= mod;
    x >>= 1;
  }
  return res;
}

int x, v;
vector<int> res;

int calc(int p, vector<int>& mp) {
  int res = x * v, pr = x * v + 1;
  for (auto x : mp) {
    while (res % x == 0 && modpow(p, res / x, pr) == 1) res /= x;
  }
  return res;
}

void dfs(int now = 0, int par = 0);

int main() {
  int t;
  cin >> t;
  while (t--) {
    cin >> v >> x;
    auto vec = fact(x * v);
    vector<int> res;
    for (int i = 1; i <= x * v; ++i)
      if (modpow(i, x, x * v + 1) == 1) res.push_back(i);
    for (int i = 0; i < x; ++i) cout << res[i] << " \n"[i == x - 1];
  }
  return 0;
}

void dfs(int now, int par) {
  if (now == x) {
    vector<long long> vec(x, 1);
    for (int i = 0; i < x; ++i) {
      long long sum = 0;
      for (int j = 0; j < x; ++j) sum += (vec[j] *= res[j]);
      if (sum % (v * x + 1) != (i == x - 1 ? x : 0)) return;
    }
    for (auto p : res) cout << p << " ";
    cout << endl;
    return;
  }
  int xv = x * v;
  for (int i = par + 1; i <= xv; ++i) {
    res[now] = i;
    dfs(now + 1, i);
  }
}
0