forked from NiharRanjan53/HacktoberFest_2022
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstructure.c
More file actions
40 lines (33 loc) · 726 Bytes
/
structure.c
File metadata and controls
40 lines (33 loc) · 726 Bytes
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];
};
vector<int> placement(int input, int input2[]) {
vector<int> r(input);
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++;
}
r[i] = cnt;
}
return r;
}
int main() {
int n; cin >> n;
int input2[n];
for (int i = 0; i < n; i++)
cin >> input2[i];
vector<int> v = placement(n, input2);
for (auto it : v) {
cout << it << " ";
}
return 0;
}