-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHackers.h
92 lines (67 loc) · 1.47 KB
/
Hackers.h
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#ifndef HACKERS_H
#define HACKERS_H
#include <iostream>
#include <cstdlib>
#include <cmath>
using namespace std;
class Hackers
{
public:
int id;
float arrival_time;
int gift_count;
int total_attempts;
int invalid_attempts;
int total_invalid_by_gift;
int commit_count;
int valid_commit_count;
int total_changed_lines;
float sticker_queue_enterance_time;
float hoodie_queue_enterance_time;
float sticker_queue_exit_time;
float hoodie_queue_exit_time;
float total_sticker_queue_time;
float total_hoodie_queue_time;
float total_tour_time;
int current_sticker_desk_index;
int current_hoodie_desk_index;
Hackers(int id, float arrival_time);
void commit(int commited_line);
};
struct CompareHackers
{
bool operator()(Hackers const& h1, Hackers const& h2)
{
if(h1.valid_commit_count<h2.valid_commit_count)
{
return true;
}
else if(h1.valid_commit_count==h2.valid_commit_count)
{
if(h1.hoodie_queue_enterance_time-h2.hoodie_queue_enterance_time>0.00001)
{
return true;
}
else if(abs(h1.hoodie_queue_enterance_time-h2.hoodie_queue_enterance_time)<0.00001)
{
if(h1.id>h2.id)
{
return true;
}
else
{
return false;
}
}
else
{
return false;
}
}
else
{
return false;
}
}
};
#endif