Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // main.cpp
- // GenirationThePassOnOlymp
- //
- // Created by Kadir Kadyrov on 9/23/19.
- // Copyright © 2019 Kadir Kadyrov. All rights reserved.
- //
- #include <iostream>
- #include <string>
- #include <algorithm>
- #include <vector>
- #include <set>
- #include <cmath>
- #include <string.h>
- #include <cstdlib>
- #include <fstream>
- #include <map>
- #define N 101
- #define MOD 1000000007
- #define LOCAL
- #undef LOCAL
- using namespace std;
- int st[25], fn[25];
- int main () {
- #ifndef LOCAL
- freopen("shop.in", "r", stdin);
- freopen("shop.out", "w", stdout);
- #endif
- int n;
- cin >> n;
- for(int i = 0; i < n; i++) {
- int start, finish;
- cin >> start >> finish;
- if(start >= finish) {
- fn[24]++;
- st[start]++;
- st[0]++;
- fn[finish]++;
- } else {
- fn[finish]++;
- st[start]++;
- }
- }
- int num, ans;
- num = ans = 0;
- for(int time = 0; time <= 24; time++) {
- num += st[time];
- num -= fn[time];
- if(num == n)
- ans++;
- }
- cout << ans << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement