Advertisement
Mizuhara_Chizuru

Untitled

Feb 9th, 2021
36
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*Code by Surya a.k.a Sunny*/
  2. #include <bits/stdc++.h>
  3. #define lli long long
  4. #define pi 3.14159265358979323846
  5. #define MOD 1000000007
  6. #define foi(n) for(lli i=0;i<n;i++)
  7. #define foj(n) for(lli j=0;j<n;j++)
  8. #define test(T) lli T;cin>>T;while(T--)
  9. using namespace std;
  10. int calch(string mytime, int t)
  11. {
  12. int mh;
  13. mh = 10 *(mytime[0 + t] - '0') + 1* (mytime[1 + t] - '0');
  14. if(mytime[6+t] == 'P'){if(mh != 12) mh += 12;}
  15. if(mytime[6 + t] == 'A') {if(mh == 12) mh-= 12;}
  16. return mh;
  17. }
  18. int calcm(string mytime, int t)
  19. {
  20. int mm;
  21. mm = 10 *(mytime[3 + t] - '0') + (mytime[4 + t] - '0');
  22. return mm;
  23. }
  24.  
  25. int main()
  26. {
  27. ios_base::sync_with_stdio(false);
  28. cin.tie(NULL);
  29. test(t)
  30. {
  31. string mytime; getline(cin, mytime);
  32. int mh = calch(mytime, 0);
  33. int mm = calcm(mytime, 0);
  34. long long n; cin>>n; cin.ignore();
  35. string res = "";
  36. while(n--)
  37. {
  38. string FTime; getline(cin, FTime);
  39. int fsh = calch(FTime, 0);
  40. int fsm = calcm(FTime, 0);
  41. int F5 = calch(FTime, 9);
  42. int F6 = calcm(FTime, 9);
  43.  
  44.  
  45. if((fsh> mh)||(F5< mh)) {res.push_back('0');}
  46. else if(fsh == mh && fsm> mm) res.push_back('0');
  47. else if(F5 == mh && F6< mm) res.push_back('0');
  48. else res.push_back('1');
  49. }
  50. cout<<res<<"\n";
  51. }
  52. return 0;
  53. }
  54.  
Advertisement
RAW Paste Data Copied
Advertisement