# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1047200 | EntityPlantt | Bouquet (EGOI24_bouquet) | C++17 | 18 ms | 1248 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
using namespace std;
const int N = 2e5 + 5;
int dp[N];
signed main() {
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
bool subt1 = true;
int n, rd;
cin >> n;
dp[0] = 1;
for (int i = 0, l, r; i < n; i++) {
cin >> l >> r;
if (l == r) {
if (!i) rd = l;
else if (rd != l) subt1 = false;
}
else subt1 = false;
if (i) dp[i] = dp[i - 1];
if (i > l) dp[i] = max(dp[i], dp[i - l - 1] + 1);
}
if (subt1) cout << (n + rd) / (rd + 1);
else cout << dp[n - 1];
return 0;
}
Compilation message (stderr)
# | 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... |