Raslboyy

114093

Feb 6th, 2020
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.45 KB | None | 0 0
  1. #include <iostream>
  2. #include <bits/stdc++.h>
  3. #define mp make_pair
  4. #define pb push_back
  5. #define eb emplace_back
  6. #define x first
  7. #define y second
  8. #define sz(x) (int)x.size()
  9. #define all(x) begin(x), end(x)
  10. #define rall(x) rbegin(x), rend(x)
  11. #define FOR(i,a,b) for (int i = (a); i < (b); i++)
  12. #define RFOR(i,b,a) for (int i = (b) - 1; i >= (a); i--)
  13.  
  14. using namespace std;
  15.  
  16. typedef unsigned long long ull;
  17. typedef long long ll;
  18. typedef long double ld;
  19. typedef pair<int, int> pi;
  20. typedef pair<ll, ll> pl;
  21. typedef vector<int> veci;
  22. typedef vector<bool> vecb;
  23. typedef vector<vector<int>> vvi;
  24. typedef vector<vector<bool>> vvb;
  25.  
  26. int main() {
  27.     ios::sync_with_stdio(false);
  28.     cin.tie(nullptr);
  29.     cout.tie(nullptr);
  30.  
  31.     int n, p, c;
  32.     cin >> n >> p >> c;
  33.     veci vec(n);
  34.     for (int i = 0; i < n; i++)
  35.         cin >> vec[i];
  36.  
  37.     veci s_v(vec);
  38.     sort(rall(s_v));
  39.  
  40.     for (int i = 0; i < n; i++){
  41.         //int j = n - (upper_bound(rall(s_v), vec[i] - c) - s_v.rbegin() + 1);
  42.         int j = lower_bound(all(s_v), vec[i] - c, greater<int>()) - s_v.begin() - 1;
  43.         if (j < p){
  44.             cout << "Pass\n";
  45.             continue;
  46.         }
  47.         //j = n - (upper_bound(rall(s_v), vec[i] + c) - s_v.rbegin() + 1);
  48.         j = lower_bound(all(s_v), vec[i] + c, greater<int>()) - s_v.begin();
  49.         if (j >= p){
  50.             cout << "Fail\n";
  51.             continue;
  52.         }
  53.         cout << "Short\n";
  54.     }
  55.  
  56.     return 0;
  57. }
Advertisement
Add Comment
Please, Sign In to add comment