-
Notifications
You must be signed in to change notification settings - Fork 0
/
BOJ_2852.cpp
69 lines (62 loc) · 1.26 KB
/
BOJ_2852.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
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
#include<iostream>
#include<vector>
#include<list>
#include<queue>
#include<cmath>
#include<string>
#include<algorithm>
#include<cstring>
#include<functional>
#include<cstdio>
#include<stack>
#pragma warning(disable:4996)
#define INTMAX 0x7fffffff
#define gets(x) cin.getline(x,sizeof(x))
#define square(x) (x)*(x)
using namespace std;
using lld = long long;
using pii = pair<int, int>;
using goal =
struct GoalType {
int time;
int winning;
};
void printres(int time) {
int m = time / 60;
int s = time % 60;
m >= 10 ? printf("%d", m) : printf("0%d", m);
s >= 10 ? printf(":%d\n", s) : printf(":0%d\n", s);
return;
}
int main(void) {
int N, score1 = 0, score2 = 0;
int res1 = 0, res2 = 0;
scanf("%d", &N);
vector<goal> v(N + 1);
for (int i = 0; i < N; i++) {
int win, m, s;
scanf("%d%d:%d", &win, &m, &s);
if (win == 1)
score1++;
else if (win == 2)
score2++;
v[i].time = m * 60 + s;
if (score1 > score2)
v[i].winning = 1;
else if (score1 < score2)
v[i].winning = 2;
else
v[i].winning = 3;
}
v[N].time = 48 * 60;
for (int i = 0; i < N; i++) {
if (v[i].winning == 1)
res1 += v[i + 1].time - v[i].time;
else if(v[i].winning == 2)
res2 += v[i + 1].time - v[i].time;
}
printres(res1);
printres(res2);
// system("pause");
return 0;
}