SHARE
TWEET

Untitled

a guest Apr 22nd, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits/stdc++.h>
  2.  
  3. #define int long long
  4.  
  5. int time_per_meter = 1;
  6.  
  7. using namespace std;
  8.  
  9. vector<int> times_actions;
  10. vector<int> distance_actions;
  11.  
  12. void check_actions(int distance, int time)
  13. {
  14.     for (int i = 0; i < distance_actions.size(); i++)
  15.         if (distance_actions[i] == distance)
  16.             time_per_meter++;
  17.  
  18.     for (int i = 0; i < times_actions.size(); i++)
  19.         if (times_actions[i] == time)
  20.             time_per_meter++;
  21. }
  22.  
  23.  
  24. signed main()
  25. {
  26.     vector<int> times(1001, -1);
  27.  
  28.     int n;
  29.     cin >> n;
  30.  
  31.     for (int i = 0; i < n; i++)
  32.     {
  33.         pair<string, int> p;
  34.         cin >> p.first >> p.second;
  35.  
  36.         if (p.second >= 0 && p.second <= 1000)
  37.         {
  38.             if (p.first == "T")
  39.                 times_actions.push_back(p.second);
  40.             else
  41.                 distance_actions.push_back(p.second);
  42.         }
  43.     }
  44.  
  45.     times[0] = 0;
  46.     check_actions(0, 0);
  47.  
  48.     for (int i = 1; i <= 1000; i++)
  49.     {
  50.         times[i] = times[i - 1] + time_per_meter;
  51.         check_actions(i, times[i]);
  52.     }
  53.  
  54.     cout << times[1000];
  55.  
  56.     return 0;
  57. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top