結果

問題 No.1206 OR, OR, OR......
コンテスト
ユーザー poohbear
提出日時 2020-08-30 13:23:16
言語 C++17
(gcc 13.3.0 + boost 1.89.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 1,983 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,081 ms
コンパイル使用メモリ 192,344 KB
最終ジャッジ日時 2025-01-13 21:06:09
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 8
権限があれば一括ダウンロードができます

ソースコード

raw source code

#include <bits/stdc++.h> #define rep(a,n) for (int a = 0; a < (n); ++a) using namespace std; using ll = long long; typedef pair<ll,ll> P; typedef pair<P,ll> PP; typedef vector<vector<ll> > Graph; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } const ll INF = 1e18; // auto mod int // depends on Template //const int mod = 1000000007; const int mod = 998244353; struct mint { ll x; // typedef long long ll; mint(ll x=0):x((x%mod+mod)%mod){} mint operator-() const { return mint(-x);} mint& operator+=(const mint a) { if ((x += a.x) >= mod) x -= mod; return *this; } mint& operator-=(const mint a) { if ((x += mod-a.x) >= mod) x -= mod; return *this; } mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;} mint operator+(const mint a) const { return mint(*this) += a;} mint operator-(const mint a) const { return mint(*this) -= a;} mint operator*(const mint a) const { return mint(*this) *= a;} mint pow(ll t) const { if (!t) return 1; mint a = pow(t>>1); a *= a; if (t&1) a *= *this; return a; } // for prime mod mint inv() const { return pow(mod-2);} mint& operator/=(const mint a) { return *this *= a.inv();} mint operator/(const mint a) const { return mint(*this) /= a;} }; istream& operator>>(istream& is, const mint& a) { return is >> a.x;} ostream& operator<<(ostream& os, const mint& a) { return os << a.x;} long long modpow(long long a, long long n) { long long res = 1; while (n > 0) { if (n & 1) res = res * a % mod; a = a * a % mod; n >>= 1; } return res; } int main(){ ll t; cin >> t; rep(test,t){ ll n,k; cin >> n >> k; mint ans = 1; ans *= n; ans *= modpow(2,k)-1; ans *= modpow(2,k*(n-1)); cout << ans << endl; } return 0; } 
0