Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define pb push_back
- #define mp make_pair
- #define fr first
- #define sc second
- #define in insert
- using namespace std;
- typedef long long ll;
- int n, p;
- int bol[100010];
- vector <ll> a, b;
- ll c;
- map <ll, int> ans;
- vector <pair<int, int> > kok;
- int main()
- {
- cin >> n >> p >> c;
- for (int i = 0; i < n; i++)
- {
- int q;
- cin >> q;
- ans[q] = i;
- a.pb(q);
- b.pb(q + c);
- kok.pb(mp(q, 0));
- }
- sort(a.rbegin(), a.rend());
- sort(b.rbegin(), b.rend());
- for (int i = 0; i < n; i++)
- {
- int pop = (int)(lower_bound(b.begin(), b.end(), a[i] + c) - b.begin());
- b[pop] = a[i];
- sort(b.rbegin(), b.rend());
- if (b[p - 1] <= a[i])
- bol[ans[a[i]]] = 2;
- else if (b[p - 1] <= a[i] + c)
- bol[ans[a[i]]] = 1;
- else
- bol[ans[a[i]]] = 0;
- pop = (int)(lower_bound(b.begin(), b.end(), a[i]) - b.begin());
- b[pop] = a[i] + c;
- sort(b.rbegin(), b.rend());
- }
- for (int i = 0; i < kok.size(); i++)
- kok[i].sc = bol[ans[kok[i].fr]];
- for (int i = 0; i < kok.size(); i++)
- if (kok[i].sc == 0)
- cout << "Fail\n";
- else if (kok[i].sc == 1)
- cout << "Short\n";
- else
- cout << "Pass\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement