結果

問題 No.1206 OR, OR, OR......
ユーザー RhoRho
提出日時 2020-07-28 22:37:18
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 604 bytes
コンパイル時間 1,713 ms
コンパイル使用メモリ 164,752 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-11 06:51:56
合計ジャッジ時間 2,486 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,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define vi vector<int>
#define all(a) a.begin(),a.end()
typedef pair<int,int> P;
const long long mod=998244353;
const long long inf=1ll<<61;

int modpow(int a,int x){
    int res=1;
    while(x){
        if(x&1)res=res*a%mod;
        a=a*a%mod;
        x>>=1;
    }
    return res;
}

int res(int n,int k){
    int a=1-modpow(2,(mod-2)*k);
    int b=modpow(2,n*k);
    a+=mod;
    return n*a%mod*b%mod;
}

signed main(){
  int t;cin>>t;
  rep(i,t){
    int a,b;cin>>a>>b;cout<<res(a,b)<<endl;
  }
}
0