Skip to content

Commit

Permalink
이슈 #359에서 솔루션 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Nov 21, 2024
1 parent d60d8a8 commit f10c4e0
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Programmers/진료순서_정하기.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

vector<int> solution(vector<int> emergency) {
vector<int> answer(emergency.size(), 0);
vector<pair<int, int>> pairs;

for (int i = 0; i < emergency.size(); i++) {
pairs.push_back({emergency[i], i});
}

sort(pairs.rbegin(), pairs.rend());

for (int i = 0; i < pairs.size(); i++) {
answer[pairs[i].second] = i + 1;
}

return answer;
}

0 comments on commit f10c4e0

Please sign in to comment.