結果

問題 No.645 Count Permutation
ユーザー vjudge1
提出日時 2025-01-27 19:16:56
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 660 bytes
コンパイル時間 2,063 ms
コンパイル使用メモリ 197,344 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2025-01-27 19:17:00
合計ジャッジ時間 3,871 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 27 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define int long long
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
template<typename T>istream&operator>>(istream&I,vector<T>&v){for(auto&i:v)I>>i;return I;}
template<typename T>ostream&operator<<(ostream&O,vector<T>&v){for(auto&i:v)O<<i<<' ';return O;}
namespace AC{
const int mod=1e9+7;
void solve(){
	int n,l,r,res=0;
	cin>>n>>l>>r;
	vector<int>dp(n);
	dp[0]=1;
	for(int x=2;x<=r;x*=2){
		vector<int>tmp(n);
		for(int i=1;i<n;i++)tmp[i]=((n-i)*tmp[i-1]+dp[i-1])%mod;
		dp=tmp;
		if(l<=x)(res+=dp[n-1])%=mod;
	}
	cout<<res;
}
}
signed main(){
	int t=1;
	//cin>>t;
	while(t--)AC::solve();
}
0