강의로 돌아가기

### 1~13전부다 틀리네요 ㅠㅠ 도와주세요!

구글링이나 다른거 봐도 생각한 논리는 똑같은거 같은데..
어디를 잘못한 걸까요?

###### 작성중인 코드―solution.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
#include <queue>
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;
int t = 0;
struct cmp {
bool operator() (const pair<vector<int>,int> a, const pair<vector<int>,int> b) {
int termA = t + a.first[1] - a.first[0];
int termB = t + b.first[1] - b.first[0];
if (termA == termB)
return a.first[0] > b.first[0] ;
return termA > termB;
}
};
bool comp (vector<int> a, vector<int> b){
return a[0] > b[0];
}
int solution(vector<vector<int>> jobs) {
int len = jobs.size();
sort(jobs.begin(), jobs.end(), comp);
while (jobs.size() > 0) {
priority_queue<pair<vector<int>, int>, vector<pair<vector<int>, int>>, cmp> pq;

for (int i = 0; i < jobs.size(); ++i)
if (jobs[i][0] <= t)
pq.push({ jobs[i], i });

if (!pq.empty()) {
vector<int> tmp = pq.top().first;
jobs.erase(jobs.begin() + pq.top().second);
t += tmp[1];