제출 #561509

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
5615092022-05-13 03:30:13gg123_pe금 캐기 (IZhO14_divide)C++14
100 / 100
128 ms11972 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define f(i,a,b) for(int i = a; i < b; i++)
const int N = 1e5 + 5;
const ll inf = 1e17 + 100;
int n;
ll a[N], g[N], e[N], sg[N], se[N], ans;
int main(){
cin >> n;
vector <pair<ll,pair<ll,ll>>> v;
f(i,1,n+1) {
cin >> a[i] >> g[i] >> e[i];
sg[i] = sg[i-1] + g[i];
se[i] = se[i-1] + e[i];
v.push_back({se[i] - a[i], {1, -sg[i]}});
v.push_back({se[i-1] - a[i], {0, sg[i-1]}});
}
ll mini = inf;
sort(v.begin(), v.end());
for(auto p: v){
ll y = p.second.second;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...