結果

問題 No.1800 Random XOR
ユーザー reg7777reg7777
提出日時 2022-01-07 22:36:54
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,072 bytes
コンパイル時間 7,059 ms
コンパイル使用メモリ 398,652 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-26 18:48:20
合計ジャッジ時間 7,735 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//long double:[1(+-),11(e),52],2^52=4.5e15
//include{{{
#include <bits/stdc++.h> 
#include <atcoder/all>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp=boost::multiprecision;
using namespace std;
//}}}
//MOD1=1e9+7 MOD2=998244353{{{
#define INF LONG_MAX
#define MOD1 1000000007
#define MOD2 998244353
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define endl "\n"
using ll=long long int;
#define int ll
//}}}
//main{{{
void main_();
signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    main_();
}
//}}}


template<int m>
int modpow(int x,int n){
    if(n==0)return 1;
    if(n%2)return((x%m)*(modpow<m>(x,n-1)%m))%m;
    else {
        int half=modpow<m>(x,n/2)%m;
        return (half*half)%m;
    }
}

void main_(){
    int N,M;
    cin>>N>>M;
    int a=((modpow<MOD1>(2,N-1))%MOD1+MOD1)%MOD1;
    a=(a*modpow<MOD1>(modpow<MOD1>(2,(M-1)),N))%MOD1;
    a=(a*((modpow<MOD1>(2,M)-1)%MOD1+MOD1)%MOD1)%MOD1;
    int b=modpow<MOD1>(2,M);
    b=modpow<MOD1>(b,N);
    b=modpow<MOD1>(b,MOD1-2);
    cout<<(a*b)%MOD1<<endl;
}
0