제출 #1306371

#제출 시각아이디문제언어결과실행 시간메모리
1306371michael12금 캐기 (IZhO14_divide)C++20
17 / 100
1 ms576 KiB
#include<bits/stdc++.h> #define ff first #define ss second #define pb push_back #define mp make_pair #define int long long using namespace std; const int maxn = 5e5; struct camp{ int x, y, z; }; signed main(){ int n; cin >> n; vector<camp> a(n); for(int i = 0; i < n; i++){ cin >> a[i].x >> a[i].y >> a[i].z; } int E = 0; int G = 0; int l = 0; int mx = 0; for(int i = 0; i < n; i++){ G += a[i].y; E += a[i].z; while(l <= i && E < a[i].x - a[l].x + 1){ G -= a[l].y; E -= a[l].z; l++; } if(l <= i && E >= a[i].x - a[l].x + 1){ mx = max(mx, G); } } cout << mx; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...