結果
| 問題 |
No.612 Move on grid
|
| コンテスト | |
| ユーザー |
Kutimoti_T
|
| 提出日時 | 2018-06-05 17:04:45 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 885 ms / 2,500 ms |
| コード長 | 750 bytes |
| コンパイル時間 | 1,550 ms |
| コンパイル使用メモリ | 164,276 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-30 09:57:01 |
| 合計ジャッジ時間 | 14,125 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 17 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
i64 T;
i64 a,b,c,d,e;
vector<i64> dp[2];
i64 MOD = 1e9 + 7;
int main(){
dp[0].resize(20202,0);
dp[1].resize(20202,0);
cin >> T >> a >> b >> c >> d >> e;
dp[0][10101] = 1;
d += 10101;
e += 10101;
vector<i64> dd = {a,b,c,-a,-b,-c};
for(int c = 1;c <= T;c++){
auto& before = dp[0];
auto& next = dp[1];
next.assign(20202,0);
for(int i = 0;i <= 20180;i++){
for(auto j : dd){
if(i - j >= 0) next[i] = (next[i] + before[i - j]) % MOD;
}
}
swap(next,before);
}
i64 ans = 0;
for(int i = d;i <= e;i++){
ans = (ans + dp[0][i]) % MOD;
}
cout << ans << endl;
}
Kutimoti_T