結果
問題 | No.1086 桁和の桁和2 |
ユーザー | chocorusk |
提出日時 | 2020-06-19 22:40:24 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,620 bytes |
コンパイル時間 | 1,156 ms |
コンパイル使用メモリ | 127,984 KB |
実行使用メモリ | 5,600 KB |
最終ジャッジ日時 | 2023-09-16 14:55:20 |
合計ジャッジ時間 | 6,435 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,380 KB |
testcase_01 | AC | 2 ms
4,376 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | AC | 1 ms
4,376 KB |
testcase_05 | AC | 140 ms
5,440 KB |
testcase_06 | WA | - |
testcase_07 | AC | 2 ms
4,376 KB |
testcase_08 | AC | 1 ms
4,376 KB |
testcase_09 | AC | 2 ms
4,376 KB |
testcase_10 | AC | 88 ms
4,564 KB |
testcase_11 | AC | 25 ms
4,376 KB |
testcase_12 | AC | 6 ms
4,380 KB |
testcase_13 | AC | 111 ms
4,952 KB |
testcase_14 | AC | 71 ms
4,376 KB |
testcase_15 | AC | 27 ms
4,380 KB |
testcase_16 | AC | 151 ms
4,712 KB |
testcase_17 | AC | 14 ms
4,380 KB |
testcase_18 | AC | 207 ms
5,416 KB |
testcase_19 | AC | 171 ms
5,032 KB |
testcase_20 | AC | 23 ms
4,380 KB |
testcase_21 | AC | 147 ms
4,776 KB |
testcase_22 | AC | 208 ms
5,424 KB |
testcase_23 | AC | 128 ms
4,536 KB |
testcase_24 | AC | 88 ms
4,380 KB |
testcase_25 | AC | 175 ms
5,196 KB |
testcase_26 | AC | 144 ms
4,656 KB |
testcase_27 | AC | 104 ms
4,380 KB |
testcase_28 | AC | 87 ms
4,376 KB |
testcase_29 | AC | 97 ms
4,376 KB |
testcase_30 | AC | 213 ms
5,284 KB |
testcase_31 | AC | 213 ms
5,468 KB |
testcase_32 | AC | 215 ms
5,260 KB |
testcase_33 | AC | 215 ms
5,320 KB |
testcase_34 | AC | 214 ms
5,280 KB |
testcase_35 | AC | 141 ms
5,600 KB |
ソースコード
#include <cstdio> #include <cstring> #include <iostream> #include <string> #include <cmath> #include <bitset> #include <vector> #include <map> #include <set> #include <queue> #include <deque> #include <algorithm> #include <complex> #include <unordered_map> #include <unordered_set> #include <random> #include <cassert> #include <fstream> #include <utility> #include <functional> #include <time.h> #include <stack> #include <array> #include <list> #define popcount __builtin_popcount using namespace std; typedef long long int ll; typedef pair<int, int> P; const ll MOD=1e9+7; ll powmod(ll a, ll k){ ll ap=a, ans=1; while(k){ if(k&1){ ans*=ap; ans%=MOD; } ap=ap*ap; ap%=MOD; k>>=1; } return ans; } ll inv(ll a){ return powmod(a, MOD-2); } int main() { int n; cin>>n; ll l[100010], r[100010]; int d[100010]; for(int i=0; i<n; i++) cin>>l[i]; for(int i=0; i<n; i++) cin>>r[i]; for(int i=0; i<n; i++) cin>>d[i]; int z=-1; for(int i=n-1; i>=0; i--){ if(d[i]==0){ z=i; break; } } for(int i=0; i<z; i++){ if(d[i]==0){ cout<<0<<endl; return 0; } } if(z==n-1){ cout<<1<<endl; return 0; } for(int i=n-1; i>=z+1; i--){ d[i]%=9; if(i) d[i]=(d[i]+9-d[i-1])%9; } ll ans=1; ll myon=inv(9); for(int i=z+1; i<n; i++){ ll c=(powmod(10, r[i])-powmod(10, l[i])+MOD)*myon%MOD; if(i>z+1 && d[i]==0) c++; (ans*=c)%=MOD; } cout<<ans<<endl; return 0; }