Submission #1063145

# Submission time Handle Problem Language Result Execution time Memory
1063145 2024-08-17T14:39:47 Z anton Trains (BOI24_trains) C++17
0 / 100
146 ms 932 KB
#include<bits/stdc++.h>

using namespace std;

#define int long long 
#define pii pair<int, int>
const int MAX_N = 1e4;
const int MOD = 1e9+7;
int N;

int d[MAX_N];
int x[MAX_N];
int dp[MAX_N];


signed main(){
    cin>>N;

    for(int i = 0; i<N; i++){
        cin>>d[i]>>x[i];
    }

    for(int i = N-1; i>=0; i--){
        dp[i] =1;
        if(d[i] != 0){
            for(int j = i+d[i]; j<=min(N-1, i+d[i]*x[i]); j++){
                dp[i] =(dp[i]+dp[j])%MOD;
            }
        }
    }

    cout<<dp[0]<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 72 ms 628 KB Output is correct
3 Correct 41 ms 572 KB Output is correct
4 Correct 146 ms 932 KB Output is correct
5 Incorrect 2 ms 600 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 856 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -