이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define ordered_set tree <int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define nemeshay ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define allr(pon) pon.rbegin(), pon.rend()
#include <ext/pb_ds/assoc_container.hpp>
#define all(pon) pon.begin(), pon.end()
#include <ext/pb_ds/tree_policy.hpp>
#define pii pair <int, int>
#define nosolve puts("-1")
#define YES puts("YES")
#define pf push_front
#define int long long
#define OK puts("OK")
#define NO puts("NO")
#define sigma signed
#define sc second
#define fr first
using namespace __gnu_pbds;
using namespace std;
const int N = 1e6 + 20, INF = 2e9 + 7;
int a[N], b[N], c[N], pb[N], pc[N];
sigma main(){
nemeshay
int n, mx = 0;
cin >> n;
for (int i = 1; i <= n; i++){
cin >> a[i] >> b[i] >> c[i];
pb[i] = b[i] + pb[i - 1];
pc[i] = c[i] + pc[i - 1];
}
for (int i = 1; i <= n; i++){
for (int j = i; j <= n; j++){
if (pc[j] - pc[i - 1] >= a[j] - a[i]) mx = max(mx, pb[j] - pb[i - 1]);
}
}
cout << mx;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |