Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <bits/stdc++.h>
- #define mp make_pair
- #define pb push_back
- #define eb emplace_back
- #define x first
- #define y second
- #define sz(x) (int)x.size()
- #define all(x) begin(x), end(x)
- #define rall(x) rbegin(x), rend(x)
- #define FOR(i,a,b) for (int i = (a); i < (b); i++)
- #define RFOR(i,b,a) for (int i = (b) - 1; i >= (a); i--)
- using namespace std;
- typedef unsigned long long ull;
- typedef long long ll;
- typedef long double ld;
- typedef pair<int, int> pi;
- typedef pair<ll, ll> pl;
- typedef vector<int> veci;
- typedef vector<bool> vecb;
- typedef vector<vector<int>> vvi;
- typedef vector<vector<bool>> vvb;
- int main() {
- ios::sync_with_stdio(false);
- cin.tie(nullptr);
- cout.tie(nullptr);
- int n, p, c;
- cin >> n >> p >> c;
- veci vec(n);
- for (int i = 0; i < n; i++)
- cin >> vec[i];
- veci s_v(vec);
- sort(rall(s_v));
- for (int i = 0; i < n; i++){
- //int j = n - (upper_bound(rall(s_v), vec[i] - c) - s_v.rbegin() + 1);
- int j = lower_bound(all(s_v), vec[i] - c, greater<int>()) - s_v.begin() - 1;
- if (j < p){
- cout << "Pass\n";
- continue;
- }
- //j = n - (upper_bound(rall(s_v), vec[i] + c) - s_v.rbegin() + 1);
- j = lower_bound(all(s_v), vec[i] + c, greater<int>()) - s_v.begin();
- if (j >= p){
- cout << "Fail\n";
- continue;
- }
- cout << "Short\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment