-
Notifications
You must be signed in to change notification settings - Fork 1
/
1138.cpp
64 lines (55 loc) · 1.22 KB
/
1138.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <functional>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <cmath>
#include <cstring>
#include <bitset>
#include <stdio.h>
#include <math.h>
#include <sstream>
#define xx first
#define yy second
#define all(x) (x).begin(), (x).end()
using namespace std;
using i64 = long long int;
using ii = pair<int, int>;
using iis = pair<int, string>;
using ii64 = pair<i64, i64>;
using iii = tuple<int, int, int>;
int main() {
int n;
scanf("%d", &n);
// 자리가 찾는지 기록하는 벡터
vector<int> v(n + 1);
for (int i = 0; i < n; i++) {
int in;
scanf("%d", &in);
int bigger = 0;
for (int j = 0; j < n; j++) {
if (v[j] == 0)
bigger++;
if (bigger == in) {
in = j + 1;
break;
}
}
while (in < n) {
if (v[in] == 0) {
v[in] = i + 1;
break;
}
in++;
}
}
for (int i = 0; i < n; i++)
printf("%d ", v[i]);
return 0;
}