結果

問題 No.1409 Simple Math in yukicoder
ユーザー sapphire__15sapphire__15
提出日時 2021-02-27 11:20:46
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 2,363 bytes
コンパイル時間 1,291 ms
コンパイル使用メモリ 123,356 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-10 15:32:44
合計ジャッジ時間 84,839 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 108 ms
6,940 KB
testcase_08 AC 334 ms
6,944 KB
testcase_09 AC 72 ms
6,944 KB
testcase_10 AC 268 ms
6,944 KB
testcase_11 AC 344 ms
6,944 KB
testcase_12 AC 258 ms
6,944 KB
testcase_13 AC 100 ms
6,944 KB
testcase_14 AC 96 ms
6,940 KB
testcase_15 AC 134 ms
6,940 KB
testcase_16 AC 114 ms
6,940 KB
testcase_17 AC 430 ms
6,944 KB
testcase_18 AC 218 ms
6,940 KB
testcase_19 AC 237 ms
6,940 KB
testcase_20 AC 176 ms
6,944 KB
testcase_21 AC 171 ms
6,940 KB
testcase_22 AC 271 ms
6,944 KB
testcase_23 AC 55 ms
6,944 KB
testcase_24 AC 55 ms
6,940 KB
testcase_25 AC 236 ms
6,944 KB
testcase_26 AC 284 ms
6,940 KB
testcase_27 AC 506 ms
6,944 KB
testcase_28 AC 482 ms
6,944 KB
testcase_29 AC 518 ms
6,944 KB
testcase_30 AC 490 ms
6,944 KB
testcase_31 AC 499 ms
6,940 KB
testcase_32 AC 499 ms
6,944 KB
testcase_33 AC 491 ms
6,944 KB
testcase_34 AC 451 ms
6,944 KB
testcase_35 AC 469 ms
6,940 KB
testcase_36 AC 509 ms
6,940 KB
testcase_37 TLE -
testcase_38 TLE -
testcase_39 TLE -
testcase_40 TLE -
testcase_41 TLE -
testcase_42 TLE -
testcase_43 TLE -
testcase_44 TLE -
testcase_45 TLE -
testcase_46 TLE -
testcase_47 TLE -
testcase_48 TLE -
testcase_49 TLE -
testcase_50 TLE -
testcase_51 TLE -
testcase_52 TLE -
testcase_53 TLE -
testcase_54 TLE -
testcase_55 TLE -
testcase_56 TLE -
testcase_57 TLE -
testcase_58 TLE -
testcase_59 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <climits>
#include <cmath>
#include <complex>
#include <functional>
#include <cassert>
#include <stack>
#include <numeric>
#include <iomanip>
#include <limits>

typedef int64_t ll;
typedef std::pair<int, int> Pii;
typedef std::pair<ll, ll> Pll;
typedef std::pair<double, double> Pdd;

#define rip(_i, _n, _s) for (int _i = (_s); _i < (int)(_n); _i++)
#define all(_l) _l.begin(), _l.end()
#define rall(_l) _l.rbegin(), _l.rend()
#define MM << " " <<

template<typename _T>
using MaxHeap = std::priority_queue<_T>;
template<typename _T>
using MinHeap = std::priority_queue<_T, std::vector<_T>, std::greater<_T>>;

template<typename _T>
inline bool chmax(_T &_l, const _T _b) {
    if (_l < _b) {
        _l = _b;
        return true;
    }
    return false;
}
template<typename _T>
inline bool chmin(_T &_l, const _T _b) {
    if (_l > _b) {
        _l = _b;
        return true;
    }
    return false;
}

// # ifdef LOCAL_DEBUG
template<typename _T>
void vdeb(const std::vector<_T> &bb) {
    for (unsigned int i = 0;i < bb.size();i++) {
        if (i == bb.size() - 1) std::cout << bb[i];
        else std::cout << bb[i] << ' ';
    }
    std::cout << '\n';
}
template<typename _T>
void vdeb(const std::vector<std::vector<_T>> &bb) {
    for (unsigned int i = 0;i < bb.size();i++) {
        std::cout << i << ' ';
        vdeb(bb[i]);
    }
    std::cout << '\n';
}
// # endif

using namespace std;

long long modpow(long long _n, long long _k, long long _p) {
    long long _ret = 1, _now = _n;
    while(_k) {
        if(_k&1) _ret = _ret * _now % _p;
        _now = _now * _now % _p;
        _k >>= 1;
    }
    return _ret;
}

void solve() {
    int v, x; cin >> v >> x;
    int p = v*x + 1, an = 1;
    rip(i,p,1) {
        int now = 1;
        bool flg = true;
        rip(j,x-1,0) {
            now = now*i%p;
            if(now%p == 1) {
                flg = false;
                break;
            }
        }
        if(flg) {
            now = i*now%p;
            if(now == 1) {
                an = i;
                break;
            }
        }
    }
    vector<int> ans(x);
    ans[0] = 1;
    rip(i,x,1) ans[i] = ans[i-1]*an%p;
    sort(all(ans));
    vdeb(ans);
}

int main() {
    int t; cin >> t;
    rip(i,t,0) solve();
}
0