#include <bits/stdc++.h>
using namespace std;
int main() {
int n; cin >> n;
vector<pair<int, int>> flowers(n, {INT_MAX, INT_MAX});
for(int i = 0; i < n; i++)
cin >> flowers[i].first >> flowers[i].second;
int c=0, i=0;
while (i<n) {
i+=flowers[i].first+1;
c++;
}
/* for (int j=0; j<n; j++) {
int k=j, cc=0;
while (k>0) {
cc++;
k-=flowers[k].first+1;
}
k = j;
while (k<n) {
k+=flowers[k+1].first+1;
cc++;
}
c = max(cc, c);
}*/
cout << c << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |