結果
問題 | No.189 SUPER HAPPY DAY |
ユーザー | pythontanuki |
提出日時 | 2022-12-26 15:47:02 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 4,500 bytes |
コンパイル時間 | 2,339 ms |
コンパイル使用メモリ | 204,428 KB |
実行使用メモリ | 9,292 KB |
最終ジャッジ日時 | 2024-05-01 01:29:54 |
合計ジャッジ時間 | 3,606 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,812 KB |
testcase_01 | AC | 2 ms
6,944 KB |
testcase_02 | AC | 2 ms
6,944 KB |
testcase_03 | AC | 2 ms
6,940 KB |
testcase_04 | AC | 1 ms
6,940 KB |
testcase_05 | AC | 1 ms
6,940 KB |
testcase_06 | AC | 2 ms
6,944 KB |
testcase_07 | AC | 2 ms
6,940 KB |
testcase_08 | AC | 2 ms
6,940 KB |
testcase_09 | AC | 1 ms
6,944 KB |
testcase_10 | AC | 2 ms
6,940 KB |
testcase_11 | AC | 2 ms
6,940 KB |
testcase_12 | AC | 2 ms
6,940 KB |
testcase_13 | AC | 5 ms
7,248 KB |
testcase_14 | AC | 7 ms
8,524 KB |
testcase_15 | AC | 8 ms
7,884 KB |
testcase_16 | AC | 9 ms
8,012 KB |
testcase_17 | AC | 9 ms
9,292 KB |
testcase_18 | AC | 8 ms
7,496 KB |
testcase_19 | AC | 11 ms
9,164 KB |
testcase_20 | AC | 4 ms
6,944 KB |
testcase_21 | AC | 3 ms
6,940 KB |
testcase_22 | AC | 2 ms
6,944 KB |
testcase_23 | WA | - |
testcase_24 | RE | - |
testcase_25 | RE | - |
ソースコード
#include <bits/stdc++.h> using namespace std; const int mod = 1000000009; const long long LINF = 1001002003004005006; const int INF = 1001001001; const double PI = acos(-1); const double EPS = 1e-10; const int di[4] = {-1,0,1,0}; const int dj[4] = {0,-1,0,1}; const int dx[8] = {1,1,1,0,0,-1,-1,-1}; const int dy[8] = {1,0,-1,1,-1,1,0,-1}; # define sz(x) (int)(x).size() # define rsz(x,n) x.resize(n) # define yosupo(x) {cout << (x) << endl; return 0;} # define ll long long # define fi first # define se second # define pb push_back # define pf push_front # define eb emplace_back # define ef emplace_front # define pob pop_back # define pof pop_front # define GET_MACRO(_1, _2, _3, NAME, ...) NAME # define _rep(i, n) _rep2(i, 0, n) # define _rep2(i, a, b) for(int i = (int)(a); i < (int)(b); i++) # define rep(...) GET_MACRO(__VA_ARGS__, _rep2, _rep)(__VA_ARGS__) # define srep(i, a, b) for(int i = a; i <= b; ++i) # define all(obj) (obj).begin(), (obj).end() # define rall(obj) (obj).rbegin(), (obj).rend() inline void YesNo(bool f) { std::cout << (f? "Yes": "No") << std::endl; } void read() {} template <typename T, class... U> void read(T &t, U &...u) { cin >> t; read(u...); } void writeln() { cout << endl; } template <typename T, class... U, char sep = ' '> void writeln(const T &t, const U &...u) { cout << t; if (sizeof...(u)) cout << sep; writeln(u...); } # define Pll pair<ll, ll> # define P pair<int,int> # define bit(x,i) (((x) >> (i)) & 1) # define equals(a, b) (fabs((a) - (b)) < EPS) // 誤差を考慮した同値判定 template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } template<typename T>istream& operator>>(istream&i,vector<T>&v){rep(j,v.size())i>>v[j];return i;} template<typename T>string join(vector<T>&v){stringstream s;rep(i,v.size())s<<' '<<v[i];return s.str().substr(1);} template<typename T>ostream& operator<<(ostream&o,vector<T>&v){if(v.size())o<<join(v);return o;} template<typename T>ostream& operator<<(ostream&o,vector<vector<T>>&vv){if(vv.size())o<<join(vv);return o;} template <class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p) { return os << "P(" << p.first << " " << p.second << ")";} template<typename T> using vc = vector<T>; template<typename T> using vv = vc<vc<T>>; using vi = vc<int>; using vvi = vv<int>; using vl = vc<ll>; using vvl = vv<ll>; ll dp_month[200][2000][2], dp_day[200][2000][2]; void solve() { string m,d; read(m,d); int month_n = sz(m), day_n = sz(d); dp_month[0][0][0] = 1, dp_day[0][0][0] = 1; rep(i,month_n) { int nd = m[i]-'0'; rep(j,i*9+1) { rep(k,2) { if(k == 0) { ll nj = j+nd; dp_month[i+1][nj][0] += dp_month[i][j][0]; dp_month[i+1][nj][0] %= mod; } else { rep(t,nd) { ll nj = j+t; dp_month[i+1][nj][1] += dp_month[i][j][0]; dp_month[i+1][nj][1] %= mod; } rep(t,10) { ll nj = j+t; dp_month[i+1][nj][1] += dp_month[i][j][1]; dp_month[i+1][nj][1] %= mod; } } } } } rep(i,day_n) { ll nd = d[i]-'0'; rep(j,i*9+1) { rep(k,2) { if(k == 0) { ll nj = j+nd; dp_day[i+1][nj][0] += dp_day[i][j][0]; dp_day[i+1][nj][0] %= mod; } else { rep(t,nd) { ll nj = j+t; dp_day[i+1][nj][1] += dp_day[i][j][0]; dp_day[i+1][nj][1] %= mod; } rep(t,10) { ll nj = j+t; dp_day[i+1][nj][1] += dp_day[i][j][1]; dp_day[i+1][nj][1] %= mod; } } } } } ll ans = 0; rep(j,1,2000) { rep(k,2) { rep(l,2) { ans += (dp_month[month_n][j][k]%mod) * (dp_day[day_n][j][l]%mod) % mod; ans %= mod; } } } cout << ans%mod << endl; } int main() { int tt = 1; //read(tt); while(tt--) { solve(); } }