Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define loop(i,from,to) for (int i = from; i < to; ++i)
- #include <bits/stdc++.h>
- using std::cin;
- using std::cout;
- using std::endl;
- using std::vector;
- using std::string;
- using std::tuple;
- using std::set;
- const int INF = 1e9+7;
- const double eps = 1e-6;
- template <typename T> void reverse(T &a) {
- long long s = a.size();
- for (long long i = 0; i < s / 2; ++i)
- std::swap(a[i], a[s - i - 1]);
- }
- signed main() {
- std::ios::sync_with_stdio(false);
- cin.tie(0);
- int t, n, dd, mm, h, m; cin >> n;
- vector<int> data;
- loop(i, 0, n) {
- scanf("%d.%d. %d:%d", &dd, &mm, &h, &m);
- t = m + h * 60 + dd * 24 * 60 + 1;
- for (int i = 2; i <= mm; ++i) {
- if (i - 1 == 1 || i - 1 == 3 || i - 1 == 5 || i - 1 == 7 || i - 1 == 8 || i - 1 == 10) t += 31 * 24 * 60;
- else if (i - 1 == 2) t += 28 * 24 * 60;
- else t += 30 * 24 * 60;
- }
- data.push_back(t);
- }
- int answ = 0;
- std::sort(data.begin(), data.end());
- for (int i = 0; i < n; i += 2)
- answ += data[i + 1] - data[i];
- cout << answ / 60 << ":" << answ % 60;
- //std::cout << "Hello World!\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement