結果
問題 | No.2017 Mod7 Parade |
ユーザー | otoshigo |
提出日時 | 2022-07-23 16:51:24 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 43 ms / 2,000 ms |
コード長 | 1,286 bytes |
コンパイル時間 | 4,192 ms |
コンパイル使用メモリ | 260,576 KB |
実行使用メモリ | 20,684 KB |
最終ジャッジ日時 | 2023-09-18 15:36:25 |
合計ジャッジ時間 | 5,915 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 7 ms
19,832 KB |
testcase_01 | AC | 8 ms
19,904 KB |
testcase_02 | AC | 7 ms
19,984 KB |
testcase_03 | AC | 35 ms
20,472 KB |
testcase_04 | AC | 26 ms
20,416 KB |
testcase_05 | AC | 21 ms
20,148 KB |
testcase_06 | AC | 38 ms
20,592 KB |
testcase_07 | AC | 11 ms
19,932 KB |
testcase_08 | AC | 25 ms
20,232 KB |
testcase_09 | AC | 14 ms
19,936 KB |
testcase_10 | AC | 25 ms
20,360 KB |
testcase_11 | AC | 31 ms
20,384 KB |
testcase_12 | AC | 28 ms
20,324 KB |
testcase_13 | AC | 42 ms
20,620 KB |
testcase_14 | AC | 43 ms
20,684 KB |
testcase_15 | AC | 43 ms
20,620 KB |
testcase_16 | AC | 42 ms
20,636 KB |
testcase_17 | AC | 42 ms
20,628 KB |
testcase_18 | AC | 43 ms
20,560 KB |
testcase_19 | AC | 38 ms
20,656 KB |
testcase_20 | AC | 7 ms
19,848 KB |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; using ll = long long; using mint = modint1000000007; #define rep(i,n) for (int i = 0; i < n; i++) #define rrep(i,n) for (int i = n-1; i >= 0; i--) #define rep2(i,a,b) for (int i = a; i < b; i++) #define rrep2(i,a,b) for (int i = a-1; i >= b; i--) #define rep3(i,a,b,c) for (int i = a; i < b; i+=c) #define rrep3(i,a,b,c) for (int i = a-1; i >= b; i-=c) #define all(v) v.begin(),v.end() #define rall(v) v.rbegin(),v.rend() template<class T> bool chmax(T &a, T b){if (a < b){a = b;return true;} else return false;} template<class T> bool chmin(T &a, T b){if (a > b){a = b;return true;} else return false;} const vector<int>M={}; int k; int D[100010],L[100010]; mint dp[100010][6][7]; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); cin>>k; rrep(i,k){ cin>>D[i]>>L[i]; L[i]%=6; } dp[0][0][0]=1; rep(i,k){ int c=0; rep(j,L[i])c=(10*c+D[i])%7; rep(j,6){ rep(l,7){ dp[i+1][j][l]+=dp[i][j][l]; dp[i+1][(j+L[i])%6][(l+c)%7]+=dp[i][j][l]; } c=10*c%7; } } mint ans=0; rep(i,6)rep(j,7)ans+=j*dp[k][i][j]; cout<<ans.val()<<"\n"; }