Submission #1118159

#TimeUsernameProblemLanguageResultExecution timeMemory
1118159PanndaBulldozer (JOI17_bulldozer)C++17
5 / 100
1 ms504 KiB
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define inf32 ((int)1e9 + 7) #define inf64 ((long long)1e18 + 7) #define MASK32(x) (1 << (x)) #define MASK64(x) (1ll << (x)) #define BIT(mask, i) (((mask) >> (i)) & 1) #define all(a) begin(a), end(a) #define isz(a) ((int)a.size()) const int N = 2e3 + 1; int n; struct Nigga { int x, y; long long v; } a[N]; void sub1() { sort(a + 1, a + n + 1, [](const Nigga& lhs, const Nigga& rhs) { return lhs.x < rhs.x; }); long long res = 0, pref = 0, mn = 0; for(int i = 1; i <= n; ++i) { pref += a[i].v; mn = min(mn, pref); res = max(res, pref - mn); } cout << res; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; bool f = 1; for(int i = 1; i <= n; ++i) { cin >> a[i].x >> a[i].y >> a[i].v; f &= (a[i].y == 0); } if(f) sub1(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...