結果
| 問題 | No.2017 Mod7 Parade |
| コンテスト | |
| ユーザー |
umezo
|
| 提出日時 | 2022-07-22 23:04:22 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 18 ms / 2,000 ms |
| コード長 | 665 bytes |
| 記録 | |
| コンパイル時間 | 1,297 ms |
| コンパイル使用メモリ | 211,848 KB |
| 実行使用メモリ | 10,496 KB |
| 最終ジャッジ日時 | 2026-06-26 18:46:26 |
| 合計ジャッジ時間 | 2,554 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 18 |
ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
#include<bits/stdc++.h>
using namespace std;
ll dp[100100][7];
const int MOD=1e9+7;
ll A[]={1,3,2,6,4,5};
ll B[]={0,1,4,6,5,2};
int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int k;
cin>>k;
vector<ll> D(k),L(k);
rep(i,k) cin>>D[i]>>L[i];
dp[0][0]=1;
for(int i=0;i<k;i++){
for(int j=0;j<7;j++){
ll t=(j*A[L[i]%6]+D[i]*B[L[i]%6])%7;
dp[i+1][t]=(dp[i+1][t]+dp[i][j])%MOD;
dp[i+1][j]=(dp[i+1][j]+dp[i][j])%MOD;
}
}
ll ans=0;
rep(i,7) ans=(ans+dp[k][i]*i%MOD)%MOD;
cout<<ans<<endl;
return 0;
}
umezo