Submission #202126

# Submission time Handle Problem Language Result Execution time Memory
202126 2020-02-14T01:14:35 Z Segtree Bulldozer (JOI17_bulldozer) C++14
20 / 100
62 ms 380 KB
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<complex>
#include<math.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef complex<long double> C;
#define chmax(a,b) a=max(a,b)
#define chmin(a,b) a=min(a,b)
#define all(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
#define mad(a,b) a=(a+b)%mod
ll n,w[110];
C p[110];
ll solve(C g,C e){
    vector<pair<long double,ll> >v;
    rep(i,n){
	C c=p[i]-g;
	c*=e;
	v.push_back(make_pair(c.imag(),i));
    }
    sort(all(v));
    ll res=0,mi=0,rui=0;
    rep(i,n){
	rui+=w[v[i].second];
	chmin(mi,rui);
	chmax(res,rui-mi);
    }
    return res;
}
int main(){
    cin>>n;
    ll ans=0;
    rep(i,n){
	ll x,y;
	cin>>x>>y>>w[i];
	p[i]=C(x,y);
	chmax(ans,w[i]);
    }
    rep(i,n)rep(j,i){
	ll dx=p[i].real()-p[j].real();
	ll dy=p[i].imag()-p[j].imag();
	chmax(ans,solve(p[j],C(dx,-dy)));
    }
    cout<<ans<<endl;
}


# Verdict Execution time Memory Grader output
1 Incorrect 39 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 58 ms 256 KB Output is correct
2 Correct 60 ms 376 KB Output is correct
3 Correct 58 ms 248 KB Output is correct
4 Correct 59 ms 376 KB Output is correct
5 Correct 58 ms 256 KB Output is correct
6 Correct 57 ms 256 KB Output is correct
7 Correct 58 ms 256 KB Output is correct
8 Correct 58 ms 256 KB Output is correct
9 Correct 62 ms 256 KB Output is correct
10 Correct 57 ms 256 KB Output is correct
11 Correct 5 ms 256 KB Output is correct
12 Correct 5 ms 256 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 5 ms 256 KB Output is correct
15 Correct 5 ms 256 KB Output is correct
16 Correct 5 ms 256 KB Output is correct
17 Correct 5 ms 376 KB Output is correct
18 Correct 5 ms 256 KB Output is correct
19 Correct 5 ms 380 KB Output is correct
20 Correct 5 ms 256 KB Output is correct
21 Correct 56 ms 376 KB Output is correct
22 Correct 55 ms 376 KB Output is correct
23 Correct 55 ms 376 KB Output is correct
24 Correct 55 ms 256 KB Output is correct
25 Correct 55 ms 256 KB Output is correct
26 Correct 54 ms 256 KB Output is correct
27 Correct 55 ms 256 KB Output is correct
28 Correct 59 ms 376 KB Output is correct
29 Correct 55 ms 380 KB Output is correct
30 Correct 55 ms 376 KB Output is correct
31 Correct 57 ms 376 KB Output is correct
32 Correct 56 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 58 ms 256 KB Output is correct
2 Correct 60 ms 376 KB Output is correct
3 Correct 58 ms 248 KB Output is correct
4 Correct 59 ms 376 KB Output is correct
5 Correct 58 ms 256 KB Output is correct
6 Correct 57 ms 256 KB Output is correct
7 Correct 58 ms 256 KB Output is correct
8 Correct 58 ms 256 KB Output is correct
9 Correct 62 ms 256 KB Output is correct
10 Correct 57 ms 256 KB Output is correct
11 Correct 5 ms 256 KB Output is correct
12 Correct 5 ms 256 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 5 ms 256 KB Output is correct
15 Correct 5 ms 256 KB Output is correct
16 Correct 5 ms 256 KB Output is correct
17 Correct 5 ms 376 KB Output is correct
18 Correct 5 ms 256 KB Output is correct
19 Correct 5 ms 380 KB Output is correct
20 Correct 5 ms 256 KB Output is correct
21 Correct 56 ms 376 KB Output is correct
22 Correct 55 ms 376 KB Output is correct
23 Correct 55 ms 376 KB Output is correct
24 Correct 55 ms 256 KB Output is correct
25 Correct 55 ms 256 KB Output is correct
26 Correct 54 ms 256 KB Output is correct
27 Correct 55 ms 256 KB Output is correct
28 Correct 59 ms 376 KB Output is correct
29 Correct 55 ms 380 KB Output is correct
30 Correct 55 ms 376 KB Output is correct
31 Correct 57 ms 376 KB Output is correct
32 Correct 56 ms 376 KB Output is correct
33 Incorrect 5 ms 376 KB Output isn't correct
34 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 58 ms 256 KB Output is correct
2 Correct 60 ms 376 KB Output is correct
3 Correct 58 ms 248 KB Output is correct
4 Correct 59 ms 376 KB Output is correct
5 Correct 58 ms 256 KB Output is correct
6 Correct 57 ms 256 KB Output is correct
7 Correct 58 ms 256 KB Output is correct
8 Correct 58 ms 256 KB Output is correct
9 Correct 62 ms 256 KB Output is correct
10 Correct 57 ms 256 KB Output is correct
11 Correct 5 ms 256 KB Output is correct
12 Correct 5 ms 256 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 5 ms 256 KB Output is correct
15 Correct 5 ms 256 KB Output is correct
16 Correct 5 ms 256 KB Output is correct
17 Correct 5 ms 376 KB Output is correct
18 Correct 5 ms 256 KB Output is correct
19 Correct 5 ms 380 KB Output is correct
20 Correct 5 ms 256 KB Output is correct
21 Correct 56 ms 376 KB Output is correct
22 Correct 55 ms 376 KB Output is correct
23 Correct 55 ms 376 KB Output is correct
24 Correct 55 ms 256 KB Output is correct
25 Correct 55 ms 256 KB Output is correct
26 Correct 54 ms 256 KB Output is correct
27 Correct 55 ms 256 KB Output is correct
28 Correct 59 ms 376 KB Output is correct
29 Correct 55 ms 380 KB Output is correct
30 Correct 55 ms 376 KB Output is correct
31 Correct 57 ms 376 KB Output is correct
32 Correct 56 ms 376 KB Output is correct
33 Incorrect 5 ms 376 KB Output isn't correct
34 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 39 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -