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
| signed main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int n; std::cin >> n;
std::map<std::pair<int, int>, bool> mp; std::vector<std::pair<int, int>> c(n); for (auto &[h, m] : c) { std::cin >> h >> m;
if (m >= 5) { mp[{h, m - 5}] = true; mp[{h, m - 3}] = true; mp[{h, m - 1}] = true; } else if (m == 4) { mp[{h - 1, 59}] = true; mp[{h, m - 3}] = true; mp[{h, m - 1}] = true; } else if (m == 3) { mp[{h - 1, 58}] = true; mp[{h, m - 3}] = true; mp[{h, m - 1}] = true; } else if (m == 2) { mp[{h - 1, 57}] = true; mp[{h - 1, 59}] = true; mp[{h, m - 1}] = true; } else if (m == 1) { mp[{h - 1, 56}] = true; mp[{h - 1, 58}] = true; mp[{h, m - 1}] = true; } else if (m == 0) { mp[{h - 1, 55}] = true; mp[{h - 1, 57}] = true; mp[{h - 1, 59}] = true; } }
std::cout << mp.size() << "\n"; for (auto [x, y] : mp) { std::cout << x.first << " " << x.second << "\n"; } return 0; }
|