結果
問題 | No.189 SUPER HAPPY DAY |
ユーザー | pione |
提出日時 | 2020-06-01 05:14:17 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 37 ms / 5,000 ms |
コード長 | 2,259 bytes |
コンパイル時間 | 1,555 ms |
コンパイル使用メモリ | 170,188 KB |
実行使用メモリ | 9,900 KB |
最終ジャッジ日時 | 2024-11-20 17:59:37 |
合計ジャッジ時間 | 2,730 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 6 ms
9,728 KB |
testcase_01 | AC | 6 ms
9,628 KB |
testcase_02 | AC | 6 ms
9,900 KB |
testcase_03 | AC | 6 ms
9,712 KB |
testcase_04 | AC | 6 ms
9,820 KB |
testcase_05 | AC | 7 ms
9,756 KB |
testcase_06 | AC | 6 ms
9,788 KB |
testcase_07 | AC | 6 ms
9,788 KB |
testcase_08 | AC | 6 ms
9,748 KB |
testcase_09 | AC | 5 ms
9,732 KB |
testcase_10 | AC | 7 ms
9,744 KB |
testcase_11 | AC | 7 ms
9,800 KB |
testcase_12 | AC | 7 ms
9,776 KB |
testcase_13 | AC | 23 ms
9,716 KB |
testcase_14 | AC | 27 ms
9,796 KB |
testcase_15 | AC | 24 ms
9,864 KB |
testcase_16 | AC | 25 ms
9,628 KB |
testcase_17 | AC | 29 ms
9,676 KB |
testcase_18 | AC | 23 ms
9,848 KB |
testcase_19 | AC | 33 ms
9,836 KB |
testcase_20 | AC | 15 ms
9,768 KB |
testcase_21 | AC | 18 ms
9,804 KB |
testcase_22 | AC | 8 ms
9,704 KB |
testcase_23 | AC | 21 ms
9,740 KB |
testcase_24 | AC | 21 ms
9,728 KB |
testcase_25 | AC | 37 ms
9,864 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; // #define int long long #define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i) #define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i) #define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--) #define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--) #define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i) #define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i) #define SORT(v, n) sort(v, v + n); #define REVERSE(v, n) reverse(v, v+n); #define vsort(v) sort(v.begin(), v.end()); #define all(v) v.begin(), v.end() #define mp(n, m) make_pair(n, m); #define cout(d) cout<<d<<endl; #define coutd(d) cout<<std::setprecision(10)<<d<<endl; #define cinline(n) getline(cin,n); #define replace_all(s, b, a) replace(s.begin(),s.end(), b, a); #define PI (acos(-1)) #define FILL(v, n, x) fill(v, v + n, x); #define sz(x) long long(x.size()) using ll = long long; using vi = vector<int>; using vvi = vector<vi>; using vll = vector<ll>; using vvll = vector<vll>; using pii = pair<int, int>; using pll = pair<ll, ll>; using vs = vector<string>; using vpll = vector<pair<ll, ll>>; using vtp = vector<tuple<ll,ll,ll>>; using vb = vector<bool>; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } const ll INF = 1e9; const ll MOD = 1000000009; const ll LINF = 1e18; // 10^200 より作れる数字和は高々2000程度 ll dp[205][2][2000]; // pos, isLess, sum of digit := count vll f(string s){ ll n=s.size(); memset(dp,0,sizeof(dp)); dp[0][0][0]=1; rep(i,n) rep(j,2) rep(k,2000){ ll now=s[i]-'0'; rep(nxt,10){ if(nxt>now&&j==0) continue; ll nj=j|nxt<now, nk=k+nxt; (dp[i+1][nj][nk]+=dp[i][j][k])%=MOD; } } vll res(2000); rep(j,2) rep(k,2000){ (res[k]+=dp[n][j][k])%=MOD; } return res; } signed main() { cin.tie( 0 ); ios::sync_with_stdio( false ); string m,d; cin>>m>>d; auto a=f(m), b=f(d); ll ans=0; rep(i,2000){ (ans+=a[i]*b[i]%MOD)%=MOD; } ans=(ans-1+MOD)%MOD; cout<<ans<<endl; }