-
Notifications
You must be signed in to change notification settings - Fork 1
/
30282.cpp
36 lines (31 loc) · 803 Bytes
/
30282.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
#include <iostream>
#include <map>
#include <utility>
#include <vector>
using namespace std;
void solve(void) {
vector<int> s(10), hpr(10), hpb(10), mpr(10), mpb(10);
for (int i=0; i<10; i++) cin >> s[i] >> hpr[i] >> hpb[i] >> mpr[i] >> mpb[i];
map<pair<int, int>, int> mp;
for (int i=0; i<10; i++) {
for (int j=hpr[i]*60+hpb[i]; j<mpr[i]*60+mpb[i]; j++) {
if (mp.find({s[i], j}) == mp.end()) {
mp[{s[i], j}] = i + 1;
} else {
cout << "NE\n" << mp[{s[i], j}] << " " << i + 1;
return;
}
}
}
int ans = 0;
for (int i=0; i<10; i++) {
ans += (mpr[i] - hpr[i]) * 60 + (mpb[i] - hpb[i]);
}
cout << "TAIP\n" << ans / 60 << " " << ans % 60;
}
int main(void) {
ios::sync_with_stdio(false);
cin.tie(nullptr);
solve();
return 0;
}