제출 #1367394

#제출 시각아이디문제언어결과실행 시간메모리
1367394lucasdmyTrains (BOI24_trains)C++20
8 / 100
215 ms980 KiB
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<pair<int, int>>v(n+10);
    vector<int>dp(n+10, 1);
    for(int k=1;k<=n;k++){
        cin>>v[k].first>>v[k].second;
    }
    for(int k=n;k>0;k--){
        if(v[k].first==0){
            continue;
        }
        int at=k+v[k].first, tot=1;
        while(tot<=v[k].second and at<=n){
            dp[k]+=dp[at];
            at+=v[k].first;
            tot++;
        }
    }
    cout<<dp[1];
}
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…