#include <iostream>
#include <vector>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int N; cin >> N;
vector<int>v(N);
for (int i = 1; i <= N; i++) { // ํค๊ฐ1์ธ ์ฌ๋๋ถํฐ ์์ํด N๋ช
๊น์ง
int key; cin >> key;
for (int j = 0; j < N; j++) { //์ค์ ํ์ํ๋.
if (v[j] == 0 && key == 0) { //์๊ธฐ ์๋ฆฌ๊ฐ ๋น์๊ณ , ํค ํฐ ์ฌ๋๋ค์ ๋ค ์ง๋์ณค์ ๋
v[j] = i;
break;
}
else if (v[j] == 0) key--; //ํค๊ฐ ํฐ ์ฌ๋์ด ์๋๋งํผ ์ง๋์น๋ค. //v[j]!=0 ๊ฒฝ์ฐ๋ ์๊ธฐ๋ณด๋ค ํค๊ฐ ์์ ์ฌ๋์ด ์ด๋ฏธ ์ฝ์
๋์ด์์.
}
}
for (int i : v) {
cout << i << " ";
}
}
'Algorithm ๐ง๐ปโ๐ป > ๋ฐฑ์ค(BOJ)' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฐฑ์ค,c++] 11404๋ฒ - ํ๋ก์ด๋ (0) | 2021.10.27 |
---|---|
[๋ฐฑ์ค,c++] 11403๋ฒ - ๊ฒฝ๋ก ์ฐพ๊ธฐ (0) | 2021.10.27 |
[๋ฐฑ์ค,c++] 11399๋ฒ - ATM (0) | 2021.10.27 |
[๋ฐฑ์ค,c++] 11365๋ฒ - !๋ฐ๋น ๊ธ์ผ (0) | 2021.10.27 |
[๋ฐฑ์ค,c++] 11328๋ฒ - strfry (0) | 2021.10.27 |
[๋ฐฑ์ค,c++] 11286๋ฒ - ์ ๋๊ฐ ํ (0) | 2021.10.27 |
๋๊ธ