forked from NiharRanjan53/HacktoberFest_2022
-
Notifications
You must be signed in to change notification settings - Fork 0
/
new.cpp
40 lines (33 loc) · 749 Bytes
/
new.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include<stdio.h>
#include<string.h>
#include<iostream>
#include <vector>
#include<bits/stdc++.h>
using namespace std;
struct Result {
Result() : output1() {};
int output1[100];
};
Result placement(int input, int input2[]) {
Result result ;
for (int i = input - 1; i >= 0; i--) {
int cnt = 0;
for (int j = i - 1; j >= 0; j--) {
if (input2[j] > input2[i])
cnt++;
}
result.output1[i] = cnt;
}
return result;
}
int main() {
int n; cin >> n;
int input2[n];
for (int i = 0; i < n; i++)
cin >> input2[i];
Result res = placement(n, input2);
for (int i = 0; i< n;i++) {
cout << res.output1[i] << " ";
}
return 0;
}