Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- #define ll long long
- #define ull unsigned ll
- #define nl "\n"
- #define sz(x) int(x.size())
- #define NumOfDigit(w) log10(w) + 1
- #define fill(arr, val) memset(arr, val , sizeof(arr))
- #define PI 3.141592654
- #define ceil(w, m) (((w) / (m)) + ((w) % (m) ? 1 : 0))
- #define all(v) v.begin(), v.end()
- #define rall(v) v.rbegin(), v.rend()
- #define fi first
- #define se second
- #define cin(v) for (auto&i:v) cin >> i;
- #define cout(v) for (auto&i:v) cout << i << " ";
- #define fixed(n) fixed << setprecision(n)
- //#define MOD 1e9 + 7
- void IO(){
- ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
- }
- void files(){
- //freopen("filename.in" , "r" ,stdin);
- #ifndef ONLINE_JUDGE
- freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
- #endif
- }
- void solve(){
- // 24 * 60 * 60 = 86400;
- vector < ll > v(86500);
- ll n ;
- cin >> n ;
- while(n--){
- string l ,r ;
- cin >> l >> r;
- ll t1= (l[0]-'0') *10 + (l[1]-'0'), s1= (l[3]-'0') *10 + (l[4]-'0');
- t1 = t1 * 60 * 60 + s1 * 60;
- ll t2 = (r[0]-'0') *10 + (r[1]-'0') , s2= (r[3]-'0') *10 + (r[4]-'0');
- t2 = t2 * 60 * 60 + s2 * 60;
- v[t1]++;
- v[t2]--;
- }
- for(int i=1;i<=86500 ;i++){
- v[i]+=v[i-1];
- }
- int q; cin >> q;
- while(q--){
- string t ;
- cin >> t;
- ll t1= (t[0]-'0') *10 + (t[1]-'0') , s1= (t[3]-'0') *10 + (t[4]-'0');
- t1 = t1 * 60 * 60 + s1 * 60;
- cout << v[t1+1] << nl;
- }
- }
- int main(){
- IO(); // files();
- int testCase=1; // one test case
- // cin >> testCase ;
- while(testCase--)
- solve(); // my code
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement