hiho week 65 register

Ended

Participants:3721

Verdict:Accepted
Score:100 / 100
Submitted:2015-09-26 20:15:25

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include<cstdio>
#include<algorithm>
using namespace std;
const int N=1010;
int X[N],Y[N],Z[N],V[N],i,j,k,m,n;
double ans[N],tim[N],t;
struct node
{
  int x,id;
}A[N];
inline bool cmp(const node &A,const node &B){return A.x<B.x;}
int main()
{
  scanf("%d",&n);
  for(i=1;i<=n;++i)
  {
    scanf("%d%d%d",&X[i],&Y[i],&V[i]);
    A[i].x=X[i],A[i].id=i,Z[i]=Y[i];
  }
  sort(Z+1,Z+1+n);
  sort(A+1,A+1+n,cmp);
  for(i=n;i>0;--i)
  {
    int now=A[i].x;
    t=0;
    for(j=1;j<=n;++j)
    if(Z[j]>X[A[i].id])
    {
      t+=(Z[j]-now)*1.0/V[A[i].id];
      t=max(t,tim[j]);
      tim[j]=t;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX