結果

問題 No.1409 Simple Math in yukicoder
ユーザー sapphire__15sapphire__15
提出日時 2021-02-27 11:16:34
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,339 bytes
コンパイル時間 1,307 ms
コンパイル使用メモリ 120,888 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-10 15:31:03
合計ジャッジ時間 64,570 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
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 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 TLE -
testcase_41 TLE -
testcase_42 TLE -
testcase_43 WA -
testcase_44 TLE -
testcase_45 TLE -
testcase_46 TLE -
testcase_47 WA -
testcase_48 TLE -
testcase_49 TLE -
testcase_50 TLE -
testcase_51 WA -
testcase_52 TLE -
testcase_53 TLE -
testcase_54 WA -
testcase_55 TLE -
testcase_56 TLE -
testcase_57 TLE -
testcase_58 TLE -
testcase_59 TLE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'void solve()':
main.cpp:103:33: warning: 'an' may be used uninitialized [-Wmaybe-uninitialized]
  103 |     rip(i,x,1) ans[i] = ans[i-1]*an%p;
main.cpp:82:22: note: 'an' was declared here
   82 |     int p = v*x + 1, an;
      |                      ^~

ソースコード

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;
    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;
    vdeb(ans);
}

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