Advertisement
Galebickosikasa

Untitled

Jan 26th, 2021
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.40 KB | None | 0 0
  1. // #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
  2. // #pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,abm,mmx,avx")
  3.  
  4. #include <iostream>
  5. #include <vector>
  6. #include <cmath>
  7. #include <algorithm>
  8. #include <unordered_map>
  9. #include <set>
  10. #include <map>
  11. #include <queue>
  12. #include <random>
  13. #include <chrono>
  14.  
  15. #define fi first
  16. #define se second
  17. #define pb push_back
  18. #define ll long long
  19. #define ld long double
  20. #define hm unordered_map
  21. #define pii pair<int, int>
  22. #define sz(a) (int)a.size()
  23. #define all(a) a.begin(), a.end()
  24. #define cinv(v) for (auto& x: v) cin >> x
  25. #define fr(i, n) for (int i = 0; i < n; ++i)
  26. #define fl(i, l, n) for (int i = l; i < n; ++i)
  27.  
  28. #define int ll
  29.  
  30. template <typename T1, typename T2> inline bool chkmin(T1 &x, const T2 &y) {if (x > y) {x = y; return 1;} return 0;}
  31. template <typename T1, typename T2> inline bool chkmax(T1 &x, const T2 &y) {if (x < y) {x = y; return 1;} return 0;}
  32.  
  33. using namespace std;
  34.  
  35. #ifdef LOCAL
  36. #define dbg(x) cerr << #x << " : " << x << '\n'
  37. #else
  38. #define dbg(x)
  39. #endif
  40.  
  41. //tg: @runningcherry
  42.  
  43. template <typename T1, typename T2> ostream& operator << (ostream& out, const pair<T1, T2>& v) {
  44. out << v.fi << ", " << v.se;
  45. return out;
  46. }
  47.  
  48. template<typename T> ostream& operator << (ostream& out, const vector<T>& v) {
  49. for (auto& x: v) out << x << " ";
  50. return out;
  51. }
  52.  
  53. template <typename T1, typename T2> istream& operator >> (istream& in, pair<T1, T2>& a) {
  54. in >> a.fi >> a.se;
  55. return in;
  56. }
  57.  
  58. const ll inf = (ll) 2e9;
  59. const ld pi = asin (1) * 2;
  60. const ld eps = 1e-8;
  61. const ll mod = (ll)1e9 + 7;
  62. const ll ns = 97;
  63.  
  64. const int maxn = 2e5 + 20;
  65.  
  66. mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
  67.  
  68.  
  69.  
  70. signed main () {
  71. ios_base::sync_with_stdio(false);
  72. cin.tie(nullptr);
  73. cout.tie(nullptr);
  74. int day, h, m;
  75. cin >> day >> h >> m;
  76. --day;
  77. int t = m + h * 60 + day * 24 * 60;
  78. vector<int> kek;
  79. int n;
  80. cin >> n;
  81. fr (i, n) {
  82. cin >> day >> h >> m;
  83. if (day == 0) {
  84. int w = h * 60 + m;
  85. fr (j, 7) {
  86. kek.pb (w);
  87. w += 24 * 60;
  88. }
  89. } else {
  90. --day;
  91. int w = m + h * 60 + day * 24 * 60;
  92. kek.pb (w);
  93. }
  94. }
  95. sort (all (kek));
  96. auto it = lower_bound (all (kek), t) - kek.begin ();
  97. int x = kek[it];
  98. day = x / 24 / 60;
  99. x %= 24 * 60;
  100. h = x / 60;
  101. x %= 60;
  102. m = x;
  103. ++day;
  104. cout << day << ' ' << h << ' ' << m << '\n';
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111. }
  112.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement