結果

問題 No.2782 メルセンヌ数総乗
ユーザー ZUBAZUBA
提出日時 2024-06-14 21:37:06
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 751 bytes
コンパイル時間 1,167 ms
コンパイル使用メモリ 108,692 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-14 21:37:20
合計ジャッジ時間 1,548 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,248 KB
testcase_02 AC 2 ms
5,248 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 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
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// #include<bits/stdc++.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<set>
#include<map>
using namespace std;
using ll = long long;
using vi=vector<int>;   
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define INF (ll)(2e18)
#define MOD ((ll)1e9+7)
const int di[]={0,1,-1,0};
const int dj[]={1,0,0,-1};


#define MAX 100000

int main(){

	int n;cin>>n;
	vl dp(n+3,0);
	ll M=(1ll<<(n+1))-1;
	auto f=[&](auto f,int k)->ll{
		if(k==1)return 1;
		if(dp[k]>0)return dp[k];
		return dp[k]=f(f,k-1)*((1ll<<k)-1)%M;
	};

	if(f(f,n)%M==0){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}

	
	




	return 0;
}
0