# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1063169 |
2024-08-17T14:49:42 Z |
anton |
Trains (BOI24_trains) |
C++17 |
|
18 ms |
3052 KB |
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pii pair<int, int>
const int MAX_N = 1e5 + 10;
const int MOD = 1e9+7;
int N;
int d[MAX_N];
int x[MAX_N];
int dp[MAX_N];
int sufs[MAX_N+1];
signed main(){
cin>>N;
for(int i = 0; i<N; i++){
cin>>d[i]>>x[i];
}
sufs[N] = 0;
for(int i = N-1; i>=0; i--){
dp[i] =1;
dp[i] = (dp[i]+sufs[i+1]-sufs[min(N, i+x[i]+1)])%MOD;
sufs[i]= (sufs[i+1]+dp[i])%MOD;
}
cout<<dp[0]<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
2 ms |
2396 KB |
Output is correct |
3 |
Correct |
2 ms |
2396 KB |
Output is correct |
4 |
Incorrect |
3 ms |
2396 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
18 ms |
3052 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |