SHARE
TWEET

Untitled

a guest May 25th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4. #include <unordered_set>
  5.  
  6. int main() {
  7.     uint64_t n = 0, x = 0, k = 0;
  8.     uint64_t count = 0;
  9.     std::unordered_set<uint64_t> rings;
  10.     std::cin >> n >> x >> k;
  11.     std::vector<uint64_t> alarms(n, 0);
  12.     for (uint64_t i = 0; i < n; i++) {
  13.         std::cin >> alarms[i];
  14.     }
  15.     std::sort(alarms.begin(), alarms.end());
  16.     uint64_t i = 0, d = 0;
  17.     while (rings.size() != k) {
  18.         rings.insert(alarms[i] + d);
  19.         i++;
  20.         if (i / n == 1 && rings.size() != k) {
  21.             i = 0;
  22.             d += x;
  23.         }
  24.     }
  25.  
  26.     std::cout << alarms[--i] + d << std::endl;
  27.     return 0;
  28. }
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