結果

問題 No.1409 Simple Math in yukicoder
ユーザー Sooh317Sooh317
提出日時 2021-02-26 22:40:07
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 2,040 bytes
コンパイル時間 2,237 ms
コンパイル使用メモリ 194,516 KB
実行使用メモリ 13,752 KB
最終ジャッジ日時 2024-04-10 13:20:19
合計ジャッジ時間 61,008 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
13,752 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 529 ms
6,940 KB
testcase_08 AC 1,808 ms
6,944 KB
testcase_09 AC 444 ms
6,940 KB
testcase_10 AC 1,438 ms
6,940 KB
testcase_11 AC 1,761 ms
6,940 KB
testcase_12 AC 1,371 ms
6,940 KB
testcase_13 AC 525 ms
6,940 KB
testcase_14 AC 411 ms
6,944 KB
testcase_15 AC 644 ms
6,944 KB
testcase_16 AC 673 ms
6,944 KB
testcase_17 TLE -
testcase_18 AC 1,164 ms
6,944 KB
testcase_19 AC 1,276 ms
6,940 KB
testcase_20 AC 1,008 ms
6,944 KB
testcase_21 AC 802 ms
6,944 KB
testcase_22 AC 1,500 ms
6,940 KB
testcase_23 AC 308 ms
6,940 KB
testcase_24 AC 250 ms
6,944 KB
testcase_25 AC 1,503 ms
6,944 KB
testcase_26 AC 1,583 ms
6,940 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; scanf("%d %d", &v, &x);
    int p = v * x + 1;
    printf("%d ", 1);
    for(int i = 2; i <= x*v; i++){
        if(modpow(i, x, p) == 1) printf("%d ", i);
    }
    printf("\n");
}
int main(){
    //cin.tie(nullptr);
    //ios::sync_with_stdio(false);
    //cout << fixed << setprecision(20);
    int t; scanf("%d", &t);
    while(t--) solve();
}       
/*
   * review your code when you get WA (typo? index?)
   * int overflow, array bounds
   * special cases (n=1?)
*/
0