# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1169396 | mnbvcxz123 | Divide and conquer (IZhO14_divide) | C++20 | 28 ms | 6844 KiB |
#include <bits/stdc++.h>
#define ll long long
#define pii pair<ll, ll>
using namespace std;
const int N = 2e5+1;
const ll INF = 1e18;
int n;
array<ll, 3> a[N];
ll pref[N], prefg[N];
ll prefmn[N];
int main()
{
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
cin >> n;
for (int i = 1; i <= n; cin >> a[i][0] >> a[i][1] >> a[i][2], i++);
sort(a+1, a+n+1);
a[0][0] = a[1][0];
a[n+1][0] = a[n][0];
vector<pii> v;
v.push_back({0, 0});
for (int i = 1; i <= n; i++) {
pref[i] = pref[i-1] - (a[i][0] - a[i-1][0]) + a[i][2];
prefg[i] = prefg[i-1] + a[i][1];
v.push_back({pref[i] - (a[i+1][0] - a[i][0]), prefg[i]});
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |