結果

問題 No.986 Present
ユーザー konjakujellykonjakujelly
提出日時 2023-11-28 22:14:54
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 17 ms / 2,000 ms
コード長 1,588 bytes
コンパイル時間 1,527 ms
コンパイル使用メモリ 169,572 KB
実行使用メモリ 6,548 KB
最終ジャッジ日時 2023-11-28 22:14:58
合計ジャッジ時間 3,063 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,548 KB
testcase_01 AC 2 ms
6,548 KB
testcase_02 AC 2 ms
6,548 KB
testcase_03 AC 9 ms
6,548 KB
testcase_04 AC 2 ms
6,548 KB
testcase_05 AC 8 ms
6,548 KB
testcase_06 AC 5 ms
6,548 KB
testcase_07 AC 2 ms
6,548 KB
testcase_08 AC 4 ms
6,548 KB
testcase_09 AC 10 ms
6,548 KB
testcase_10 AC 2 ms
6,548 KB
testcase_11 AC 7 ms
6,548 KB
testcase_12 AC 7 ms
6,548 KB
testcase_13 AC 2 ms
6,548 KB
testcase_14 AC 3 ms
6,548 KB
testcase_15 AC 15 ms
6,548 KB
testcase_16 AC 3 ms
6,548 KB
testcase_17 AC 11 ms
6,548 KB
testcase_18 AC 7 ms
6,548 KB
testcase_19 AC 5 ms
6,548 KB
testcase_20 AC 2 ms
6,548 KB
testcase_21 AC 15 ms
6,548 KB
testcase_22 AC 12 ms
6,548 KB
testcase_23 AC 6 ms
6,548 KB
testcase_24 AC 17 ms
6,548 KB
testcase_25 AC 4 ms
6,548 KB
testcase_26 AC 17 ms
6,548 KB
testcase_27 AC 11 ms
6,548 KB
testcase_28 AC 2 ms
6,548 KB
testcase_29 AC 2 ms
6,548 KB
testcase_30 AC 2 ms
6,548 KB
testcase_31 AC 2 ms
6,548 KB
testcase_32 AC 1 ms
6,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

inline int read() {
	int x = 0, f = 0; char ch = getchar();
	while(ch < '0' or ch > '9') f |= (ch == '-'), ch = getchar();
	while(ch >= '0' and ch <= '9') x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
	return f ? -x : x;
}

int __stk[128], __top;
inline void write(int x) {
    if(x < 0) putchar('-'), x = -x;
	do { __stk[++__top] = x % 10, x /= 10; } while(x);
	while (__top) putchar(__stk[__top--] + '0');
}

const int mod = 998244353;

void Min(int &x, int y) { y < x and (x = y); }
void Max(int &x, int y) { y > x and (x = y); }

void inc(int &x, int y) { (x += y) >= mod and (x -= mod); }
void mul(int &x, int y) { x = 1ll * x * y % mod; }

int q_pow(int x, int k) { int res = 1; for(; k; k >>= 1, mul(x, x)) if(k & 1) mul(res, x); return res; }

bool stmer;

const int N = 2e5 + 10;

int n, m, ans = 1, res = 1;

bool edmer;
signed main() {
	// freopen("T.in", "r", stdin);
	// freopen("T.out", "w", stdout);
	cerr << "[Memory] " << (&stmer - &edmer) / 1024 / 1024 << " MB\n";
	
    n = read(), m = read();
    write(q_pow(2, n)), putchar(' ');
    
    int tot = q_pow(2, m), fac = 1;

    for(int i = 1, now = 1; i <= n; i++) {
        mul(ans, (tot - now + mod) % mod);
        mul(res, (q_pow(2, n) - now + mod) % mod);
        mul(now, 2), mul(fac, i);
    }

    int inv = q_pow(fac, mod - 2);
    
    mul(ans, inv), mul(res, inv);

    write(ans), putchar(' ');

    write(1ll * ans * q_pow(res, mod - 2) % mod), putchar(' ');

    cerr << "[Runtime] " << (double) clock() / CLOCKS_PER_SEC << " seconds\n";
	return 0;
} 
0