# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1097116 | Trisanu_Das | Bouquet (EGOI24_bouquet) | C++17 | 21 ms | 4280 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 <bits/stdc++.h>
using namespace std;
#define int long long
int dp[200005];
signed main() {
ios::sync_with_stdio(0); cin.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) << '\n';
else cout << dp[n - 1] << '\n';
}
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... |