제출 #1051295

#제출 시각아이디문제언어결과실행 시간메모리
1051295thelegendary08Bouquet (EGOI24_bouquet)C++14
18 / 100
19 ms6092 KiB
#include<bits/stdc++.h> #define pb push_back #define int long long #define vi vector<int> #define vvi vector<vector<int>> #define vll vector<long long int> #define vvll vector<vector<long long int>> #define pii pair<int, int> #define vpii vector<pair<int, int>> #define vc vector<char> #define vvc vector<vector<char>> #define vb vector<bool> #define mii map<int,int> #define mll map<long long int, long long int> #define mivi map<int,vector<int>> #define f0r(i,n) for(int i=0;i<n;i++) #define FOR(i,k,n) for(int i=k;i<n;i++) using namespace std; const int mxn = 1005; vi adj[mxn]; signed main(){ ios::sync_with_stdio(false); cin.tie(NULL); //ifstream cin(".in"); //ofstream cout(".out"); int n; cin>>n; vpii v(n); f0r(i, n)cin>>v[i].first>>v[i].second; int dp[n]; dp[0] = 1; FOR(i, 1, n){ dp[i] = 1; for(int j = max(i-5, 0ll); j<i; j++){ if(j + v[j].second < i && i - v[i].first > j)dp[i] = max(dp[i], dp[j] + 1); } } int ans = 0; f0r(i, n)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...