-
Notifications
You must be signed in to change notification settings - Fork 0
/
checker.cpp
44 lines (35 loc) · 939 Bytes
/
checker.cpp
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
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <algorithm>
#include "utils.hpp"
#include "ride.hpp"
#include "input.hpp"
#include "checker.hpp"
long long Checker::SimulateCar( const std::vector< int > &rideList )
{
long long score = 0;
unsigned long long time = 0;
Point curPos;
for( size_t i=0; i < rideList.size(); ++ i )
{
Ride curRide = world.allRides[ rideList[i] ];
unsigned long long arrive = time + MDistance( curPos, curRide.from );
if( arrive <= curRide.start )
score += world.bonus;
time = std::max( curRide.start, arrive );
time += curRide.dist;
if( time <= curRide.end )
score += curRide.dist;
curPos = curRide.to;
}
return score;
}
long long Checker::SimulateFleet( const std::vector< std::vector< int > > &rideList )
{
long long score = 0;
for( size_t i=0; i < rideList.size(); ++ i )
score += SimulateCar( rideList[i] );
lastScore = score;
if( score > maxScore )
maxScore = score;
return score;
}
Checker checker;