Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <string>
- #include <cstdio>
- #include <algorithm>
- #include <cmath>
- #include <queue>
- using namespace std;
- int main() {
- ios_base::sync_with_stdio(false);
- cin.tie(0);
- cin.tie(0);
- int n, k;
- bool t = false;
- cin >> n;
- vector<int> info;
- vector<int> answer;
- for (int i = 1; i <= n; i++) {
- cin >> k;
- info.push_back(k);
- }
- for (int i = 0; i <n; i++) {
- k = info[i];
- for (int y = i+1; y <n; y++) {
- if (info[y] < k) {
- answer.push_back(y);
- t = true;
- break;
- }
- }
- if (t) {
- t = false;
- continue;
- }
- else { answer.push_back(-1); }
- }
- for (int k : answer)
- cout << k<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement