# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1084761 |
2024-09-06T23:21:31 Z |
zxcigan |
Trains (BOI24_trains) |
C++17 |
|
13 ms |
4192 KB |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
const int N = 2e5;
const int mod = 1e9 + 7;
const int B = 335;
int dp[N];
int32_t main() {
#ifdef LOCAL
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif // LOCAL
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
dp[1] = 1;
int s = 0;
vector<vector<int>> add (B + 1, vector<int> (B + 1, 0));
set<array<int,2>> st;
vector<int> pref (n + 3);
int C = 0;
for (int i = 1; i <= n; ++i) {
int x, d;
cin >> d >> x;
if (i != 1) dp[i] = C;
if (x && d) {
(C += dp[i]) %= mod;
(pref[min (n + 1, i + x * d)] += dp[i]) %= mod;
}
C -= pref[i];
if (C < 0) C += mod;
(s += dp[i]) %= mod;
}
// cout << dp[3] << '\n';
cout << s << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
1116 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
1116 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1116 KB |
Output is correct |
2 |
Correct |
1 ms |
1372 KB |
Output is correct |
3 |
Correct |
1 ms |
1372 KB |
Output is correct |
4 |
Correct |
1 ms |
1372 KB |
Output is correct |
5 |
Correct |
6 ms |
2396 KB |
Output is correct |
6 |
Correct |
10 ms |
3672 KB |
Output is correct |
7 |
Correct |
10 ms |
3768 KB |
Output is correct |
8 |
Correct |
1 ms |
1112 KB |
Output is correct |
9 |
Correct |
1 ms |
1116 KB |
Output is correct |
10 |
Correct |
1 ms |
1224 KB |
Output is correct |
11 |
Correct |
2 ms |
1628 KB |
Output is correct |
12 |
Correct |
13 ms |
4192 KB |
Output is correct |
13 |
Correct |
1 ms |
1116 KB |
Output is correct |
14 |
Correct |
2 ms |
1512 KB |
Output is correct |
15 |
Correct |
11 ms |
3928 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
1884 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
1116 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |