Advertisement
bogolyubskiyalexey

Untitled

Mar 21st, 2021
866
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.88 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <map>
  4.  
  5. std::map<double, int> roadStarts;
  6.  
  7.  
  8. std::vector<int> getRoadIndexes(double position) {
  9.     auto it = roadStarts.lower_bound(position);
  10.     if (it->first == position) {
  11.         return {it->second - 1, it->second};
  12.     }
  13.     return {it->second};
  14. }
  15.  
  16. bool isDuoLineRoad(int index) {
  17.    
  18. }
  19.  
  20. int main() {
  21.     int T, R, K, L = 0;
  22.     std::cin >> T >> R >> K;
  23.     std::vector<int> road(K + 2, 0);
  24.     for (int i = 1; i <= K; ++i) {
  25.         std::cin >> road[i];
  26.         roadStarts[L] = i;
  27.         L += road[i];
  28.     }
  29.     roadStarts[L] = K + 1;
  30.     double A = 0;
  31.     double B = L;
  32.     while (true) {
  33.         double meetingTime = (B - A) / 2;
  34.         double meetingPlace = meetingTime + A;
  35.         auto meetingRoadIndexes = getRoadIndexes(meetingPlace);
  36.         if (meetingRoadIndexes.size()) {
  37.  
  38.         }
  39.     }
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement