結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
10,016 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 502 ms
6,944 KB
testcase_08 AC 1,650 ms
6,940 KB
testcase_09 AC 428 ms
6,940 KB
testcase_10 AC 1,324 ms
6,940 KB
testcase_11 AC 1,649 ms
6,940 KB
testcase_12 AC 1,250 ms
6,940 KB
testcase_13 AC 481 ms
6,948 KB
testcase_14 AC 372 ms
6,940 KB
testcase_15 AC 573 ms
6,944 KB
testcase_16 AC 611 ms
6,940 KB
testcase_17 TLE -
testcase_18 AC 1,087 ms
6,940 KB
testcase_19 AC 1,171 ms
6,944 KB
testcase_20 AC 930 ms
6,940 KB
testcase_21 AC 738 ms
6,944 KB
testcase_22 AC 1,398 ms
6,940 KB
testcase_23 AC 286 ms
6,944 KB
testcase_24 AC 227 ms
6,944 KB
testcase_25 AC 1,350 ms
6,944 KB
testcase_26 AC 1,461 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;
#pragma region atcoder
//#include <atcoder/modint>
//using namespace atcoder;
//using mint = modint998244353;
//using mint = modint1000000007;
#pragma endregion
#pragma region debug for var, v, vv
#define debug(var)  do{std::cerr << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cerr << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cerr << e << " "; } std::cerr << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){cerr << endl;int cnt = 0;for(const auto& v : vv){cerr << cnt << "th : "; view(v); cnt++;} cerr << endl;}
#pragma endregion
using ll = long long;
const ll mod = 1000000007;
const int inf = 1001001001;
const ll INF = 1001001001001001001ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
template<class T, class K>bool chmax(T &a, const K b) { if (a<b) { a=b; return 1; } return 0; }
template<class T, class K>bool chmin(T &a, const K b) { if (b<a) { a=b; return 1; } return 0; }
ll rudiv(ll a, ll b) { return a/b+((a^b)>0&&a%b); } //  20 / 3 == 7
ll rddiv(ll a, ll b) { return a/b-((a^b)<0&&a%b); } // -20 / 3 == -7
ll power(ll a, ll p){ll ret = 1; while(p){if(p & 1){ret = ret * a;} a = a * a; p >>= 1;} return ret;}
ll modpow(ll a, ll p, ll m){ll ret = 1; while(p){if(p & 1){ret = ret * a % m;} a = a * a % m; p >>= 1;} return ret;}
/*---------------------------------------------------------------------------------------------------------------------------------*/
void solve(){
    int v, x; cin >> v >> x;
    int p = v * x + 1;
    cout << 1 << " ";
    for(int i = 2; i <= x*v; i++){
        if(modpow(i, x, p) == 1) cout << i << " ";
    }
}
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    //cout << fixed << setprecision(20);
    int t; cin >> t;
    while(t--) solve();
}       
/*
   * review your code when you get WA (typo? index?)
   * int overflow, array bounds
   * special cases (n=1?)
*/
0