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;
#define double long double
const double pi = acos(-1);
struct point{
double x,y;
int w;
point(double x=0,double y=0,int w=0): x(x), y(y), w(w) {}
};
int n;
point a[2005];
void rotate(point &P,double alpha){
double tx = P.x * cos(alpha) - P.y * sin(alpha);
double ty = P.x * sin(alpha) + P.y * cos(alpha);
P.x = tx;
P.y = ty;
}
bool cmp(point p,point q){
return p.x < q.x;
}
int main(){
iostream::sync_with_stdio(0);
cin >> n;
for(int i=1;i<=n;i++)
cin >> a[i].x >> a[i].y >> a[i].w;
long long ans = 0;
int _Time = 10000;
for(int i=0;i<_Time;i++){
sort(a+1,a+n+1,cmp);
long long mi = 0, sum = 0;
for(int j=1;j<=n;j++){
sum += a[j].w;
//cout << a[j].w << ' ';
ans = max(ans, sum - mi);
mi = min(mi, sum);
}
for(int j=1;j<=n;j++){
rotate(a[j], pi / _Time);
}
//cout << endl;
}
cout << ans;
}
# | 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... |