제출 #1183249

#제출 시각아이디문제언어결과실행 시간메모리
1183249vneduBulldozer (JOI17_bulldozer)C++20
5 / 100
1 ms328 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; template<class T> bool maximize(T &a, const T &b){ return (a < b ? a = b, 1 : 0); } template<class T> bool minimize(T &a, const T &b){ return (a > b ? a = b, 1 : 0); } #define fi first #define se second #define pb push_back #define ii pair<int, int> #define all(x) x.begin(), x.end() #define TASK "nonsense" /// end of template /// const int N = 2e3 + 23; int n; struct Point { int x,y,c; Point() {} void input() { cin>>x>>y>>c; } } point[N]; namespace sub1 { bool check() { if (n>100) return 0; for (int i=1; i<=n; ++i) if (point[i].y!=0) return 0; return 1; } bool cmp1(Point &x, Point &y) { return x.x<y.x; } void solve() { sort(point+1,point+1+n,cmp1); ll ans=0; for (int i=1; i<=n; ++i) { ll sum=0; for (int j=i; j<=n; ++j) { sum+=point[j].c; maximize(ans,sum); } } cout<<ans; } } void solve() { cin>>n; for (int i=1; i<=n; ++i) point[i].input(); if (sub1::check()) return void(sub1::solve()); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); // freopen(TASK".inp","r",stdin); // freopen(TASK".out","w",stdout); int testcase=1; // cin>>testcase; while (testcase--) solve(); 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...