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>
using namespace std;
typedef long long ll;
typedef vector<int>vi;
#define pb push_back
#define sz(v) (int)v.size()
#define all(x) begin(x),end(x)
#define FOR(i,a,b) for(int i=a; i<b; i++)
#define ROF(i,a,b) for(int i=b-1; i>=a; i--)
//------------------------------------------------//
typedef long double ld;
void ckmax(ll &x, ll y){x=max(x,y);}
void IO(){
#ifdef LOCAL
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif
}
int main(){
IO();
int N; cin>>N;
vi X(N),Y(N),V(N);
FOR(i,0,N) cin>>X[i]>>Y[i]>>V[i];
ll ans=0;
FOR(i,0,N) FOR(j,i+1,N){
if(X[i]!=X[j]){
FOR(k,0,N) if(k!=i && k!=j){
ld a=(ld)(Y[j]-Y[i])/(X[j]-X[i]);
ld b=Y[i]-a*X[i];
ld c=Y[k]-a*X[k];
if(b>c) swap(b,c);
ll val=0;
FOR(l,0,N){
ld d=Y[l]-a*X[l];
if(d>=b && d<=c) val+=V[l];
}
ckmax(ans,val);
}
}
}
cout << ans << endl;
}
# | 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... |