結果
問題 | No.645 Count Permutation |
ユーザー |
![]() |
提出日時 | 2025-01-27 19:14:00 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 659 bytes |
コンパイル時間 | 2,393 ms |
コンパイル使用メモリ | 195,732 KB |
実行使用メモリ | 5,504 KB |
最終ジャッジ日時 | 2025-01-27 19:14:04 |
合計ジャッジ時間 | 4,253 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 WA * 7 |
ソースコード
#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,x=2,res=0; cin>>n>>l>>r; vector<int>dp(n); dp[0]=1; while(x<=r){ vector<int>DP(n+1); for(int i=1;i<n;i++)DP[i]=((n-i)*DP[i-1]+dp[i-1])%mod; dp=DP; if(l<=x)(res+=dp[n-1])%=mod; x*=2; } cout<<res; } } signed main(){ int t=1; //cin>>t; while(t--)AC::solve(); }