結果

問題 No.1409 Simple Math in yukicoder
ユーザー morimariomorimario
提出日時 2021-02-26 23:16:48
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 4,442 bytes
コンパイル時間 5,707 ms
コンパイル使用メモリ 268,628 KB
実行使用メモリ 19,284 KB
最終ジャッジ日時 2023-07-25 23:03:06
合計ジャッジ時間 63,053 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,384 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,384 KB
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 TLE -
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 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 #

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
using ll = long long; using ull = unsigned long long; using pil = pair<int, ll>; using pli = pair<ll, int>;
using pii = pair<int, int>; using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using pll = pair<ll, ll>; using vl = vector<ll>; using vvl = vector<vl>; using vvvl = vector<vvl>;
using pbb = pair<bool, bool>; using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using pcc = pair<char, char>; using vc = vector<char>; using vvc = vector<vc>; using vvvc = vector<vvc>;
using pss = pair<string, string>; using vs = vector<string>; using vvs = vector<vs>; using vvvs = vector<vvs>;
using pdd = pair<double, double>; using vd = vector<double>; using vvd = vector<vd>; using vvvd = vector<vvd>;
template <typename T> using pq = priority_queue<T, vector<T>>; template <typename T> using pql = priority_queue<T, vector<T>, greater<T>>;
#define rep0(times) for(int counter = 0; counter < (int)(times); ++counter)
#define rep(counter, goal) for (int counter = 0; counter < (int)(goal); ++counter)
#define rep2(counter, start, goal) for (int counter = (int)(start); counter < (int)(goal); ++counter)
#define rep3(counter, start, goal) for (int counter = (int)(start); counter > (int)(goal); --counter)
#define all(container) begin(container), end(container)
template <typename T> bool chmax(T &x, const T &y) { if (x < y) { x = y; return true; } return false; }
template <typename T> bool chmin(T &x, const T &y) { if (x > y) { x = y; return true; } return false; }
void Yn(bool flag) { cout << (flag ? "Yes" : "No") << "\n"; }
void yn(bool flag) { cout << (flag ? "yes" : "no") << "\n"; }
void YN(bool flag) { cout << (flag ? "YES" : "NO") << "\n"; }
void set_prec(const int &digits) { cout << fixed << setprecision(digits); cerr << fixed << setprecision(digits); }
template <typename T> T INF() { return numeric_limits<T>::max(); }
#include <atcoder/all>
using namespace atcoder;
// using mint = atcoder::modint1000000007;
// using mint = atcoder::modint998244353;
using mint = atcoder::modint;
using pmm = pair<mint, mint>; using vm = vector<mint>; using vvm = vector<vm>; using vvvm = vector<vvm>;
void pr(const mint &obj) { cerr << obj.val(); }
template <typename T> void pr(const T &obj) { cerr << obj; }
template <typename T, typename ...Ts> void pr(const T &first, const Ts &...rest) { pr(first); pr(", "); pr(rest...); }
template <typename S, typename T> void pr(const pair<S, T> &pair) { pr("("); pr(pair.first); pr(", "); pr(pair.second); pr(")"); }
template <typename T> void pr(const vector<T> &vec) { pr("{"); for (T obj : vec) { pr(obj); pr(", "); } pr("}"); }
template <typename T> void pr(const vector<vector<T>> &vv) { pr("\n"); rep(index, vv.size()) { pr("["); pr(index); pr("]: "); pr(vv[index]); pr("\n"); } }
template <typename T> void pr(const set<T> &vec) { pr("{"); for (T obj : vec) { pr(obj); pr(", "); } pr("}"); }
template <typename S, typename T> void pr(const map<S, T> &map) { pr("{"); for (pair<S, T> pair : map) { pr("("); pr(pair.first); pr(": "); pr(pair.second); pr("), "); } pr("}"); }
#define db(obj) cerr << #obj << ": "; pr(obj); cerr << " "
#define dl(obj) db(obj); cerr << "\n"
#define dm(...) cerr << "(" << #__VA_ARGS__ << "): ("; pr(__VA_ARGS__); cerr << ") "
#define dml(...) dm(__VA_ARGS__); cerr << "\n"
const ll MOD = 1000000007;
// const ll MOD = 998244353;

// mod p = xv+1 で 位数 x の元 a を見つければよい
// a, a^2, a^3,... a^(x-1), a^x(=1) をソートしたものが所望の数列となる

void solve() {
	int v, x; cin >> v >> x;
	int p = v * x + 1;
	// dl(p); // *
	mint::set_mod(p);
	rep2(i, 1, p) {
		vb r(p, true);
		r[0] = false;
		int cur = i;
		for (; cur < p; ++cur) {
			if (!r[cur]) continue;
			set<int> w;
			w.insert(1);
			mint a(cur);
			// dl(cur);
			for (; a != 1; a *= cur) {
				w.insert(a.val());
				r[a.val()] = false;
			}
			// dl(r); dl(w); dl(w.size());
			if (w.size() == x) {
				for (int wi : w) {
					cout << wi << " ";
				}
				cout << endl;
				return;
			} else if (w.size() > x) {
				int t = w.size() / x;
				mint a = mint(cur).pow(t);
				vi u;
				mint b(1);
				u.push_back(b.val());
				rep0(x - 1) {
					b *= a;
					u.push_back(b.val());
				}
				sort(all(u));
				for (int ui : u) {
					cout << ui << " ";
				}
				cout << endl;
				return;
			}
		}
	}
}

int main() {
	int T; cin >> T;
	rep0(T) solve();
}
0