Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*#define _FORTIFY_SOURCE 0
- #pragma GCC optimize("Ofast")
- #pragma GCC optimize("no-stack-protector")
- #pragma GCC optimize("unroll-loops")
- #pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
- #pragma GCC optimize("fast-math")*/
- #include <iostream>
- #include <map>
- #include <set>
- #include <vector>
- #include <algorithm>
- using namespace std;
- const int N = 1e6;
- #define int long long
- string b[N];
- pair <int, int> a[N];
- signed main()
- {
- ios_base::sync_with_stdio(0);
- int n, p, c;
- cin >> n >> p >> c;
- for (int i = 0; i < n; i++) {
- cin >> a[i].first;
- b[i] = "Fail";
- a[i].second = i;
- }
- if (p == n) {
- for (int i = 0; i < n; i++) {
- cout << "Pass\n";
- }
- return 0;
- }
- sort(a, a + n);
- reverse(a, a + n);
- int etalon = a[p - 1].first;
- for (int i = 0; i < p; i++) {
- b[a[i].second] = "Pass";
- }
- // cout <<etalon;
- bool ok = false;
- for (int i = 0; i < p; i++) {
- if (a[i].first - c < a[p].first) b[a[i].second] = "Short", ok = true;
- }
- if (ok || a[p].first + c >= etalon) {
- b[a[p].second] = "Short";
- }
- for (int i = p + 1; i <= n - 1; i++) {
- if (a[i].first + c >= etalon) {
- b[a[i].second] = "Short";
- }
- }
- for (int i = 0; i < n; i++) {
- cout << b[i] << "\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement