제출 #1167177

#제출 시각아이디문제언어결과실행 시간메모리
1167177tsengangBouquet (EGOI24_bouquet)C++20
0 / 100
0 ms328 KiB
#include <bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define pb push_back
#define ertunt return
#define vodka void
#define sleepearly ertunt
using namespace std;
int main() {
    ll n;
    vector<ll>l(n),r(n);
    for(ll i = 0; i < n; i++){
        cin >> l[i] >> r[i];
    }
    vector<ll>dp(n+4,1);
    ll ans = 0;
    for(ll i = 0; i < n; i++){
        for(ll j = i - l[i]-1; j >= i-l[i] - 4; j--){
            if(i-j > r[j]){
                dp[i] = max(dp[j]+1,dp[i]);
            }
        }
        ans = max(ans,dp[i]);
    }
    cout << ans ;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...