# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1118178 | pemguimn | Bulldozer (JOI17_bulldozer) | C++14 | 1 ms | 528 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define pii pair<int, int>
#define int long long
using namespace std;
const int N = 2e3 + 5;
struct pt{
int x, y, w, id;
};
vector<pt> a; int n;
namespace sub1{
void solve(){
sort(a.begin(), a.end(), [](pt &x, pt &y){return x.x < y.x;});
int ans = 0;
for(int i = 0; i < n; i++){
int sum = 0;
for(int j = i; j < n; j++){
sum += a[j].w;
ans = max(ans, sum);
}
}
cout << ans << '\n';
}
}
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
#define task "truffle"
if(fopen(task".inp", "r")){
freopen(task".inp", "r", stdin);
freopen(task".out", "w", stdout);
}
cin >> n;
for(int i = 0; i < n; i++){
int x, y, w; cin >> x >> y >> w;
a.push_back({x, y, w, i});
}
sub1::solve();
// full::solve();
return 0;
}
/*
5
-5 5 -2
2 5 10
1 4 -2
4 -5 4
-2 2 7
6
0 0 6
1 0 -2
2 0 8
0 1 -2
1 1 5
2 1 -2
5
0 0 2
4 0 2
3 2 -1
1 2 2
1 1 -1
2
0 0 -1
1 0 -1
*/
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |