結果

問題 No.2011 Arbitrary Mod (Hidden)
ユーザー ruthenruthen
提出日時 2022-07-15 23:13:48
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,130 bytes
コンパイル時間 2,251 ms
コンパイル使用メモリ 213,020 KB
実行使用メモリ 9,008 KB
最終ジャッジ日時 2023-09-10 04:53:27
合計ジャッジ時間 8,488 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#ifdef _RUTHEN
#include "debug.hpp"
#else
#define show(...) true
#endif

using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
template <class T> using V = vector<T>;

ll f(ll a, ll N, ll M) {
    rep(i, N) a = a * a % M;
    return a;
}

map<long long, int> prime_map(long long n) {
    map<long long, int> res;
    for (long long i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            res[i]++;
            n /= i;
        }
    }
    if (n != 1) res[n]++;
    return res;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll N;
    cin >> N;
    map<int, int> mp;
    V<int> CV;
    for (ll a = 20; a <= 5000; a++) {
        ll c = a * a - 398;
        if (c % 2 == 0) continue;
        CV.push_back(c);
        auto res = prime_map(c);
        for (auto [p, cnt] : res) mp[p]++;
    }
    ll M = 2;
    for (auto [p, cnt] : mp) {
        if (M >= 1000000000000000000LL / p) {
            show(p);
            break;
        }
        M *= p;
    }
    show(M);
    cout << M << '\n';
    cout << f(2, N, M) << '\n';
    return 0;
}
0