# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1064727 | cpdreamer | Golf (JOI17_golf) | C++14 | 18 ms | 348 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>
#include <ext/pb_ds/assoc_container.hpp>
#include <utility>
#define V vector
#define P pair
#define S second
#define F first
#define pb push_back
#define all(v) v.begin(),v.end()
typedef long long ll;
using namespace __gnu_pbds;
using namespace std;
typedef tree<int,null_type,less<int>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
static int called = 0;const long long MOD = 1e9+7; // 1e9 + 7
void file(){
freopen("input.txt.txt","r",stdin);
freopen("output.txt.txt","w",stdout);
}
struct point{
int x;
int y;
int w;
};
bool sorted(point a,point b){
return a.x<b.x;
}
void solve() {
int n;
cin>>n;
point A[n];
for(int i=0;i<n;i++)
cin>>A[i].x>>A[i].y>>A[i].w;
sort(A,A+n,sorted);
ll ans=0;
for(int i=0;i<n;i++){
for(int j=i;j<n;j++){
ll c=0;
for(int g=i;g<=j;g++){
c+=A[g].w;
}
ans=max(ans,c);
}
}
cout<<ans<<endl;
}
int main(){
//file();
solve();
}
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... |