답안 #1060829

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1060829 2024-08-16T01:48:01 Z boyliguanhan Job Scheduling (IOI19_job) C++17
24 / 100
88 ms 9680 KB
#include "job.h"
#include <bits/stdc++.h>
using namespace std;
struct DATA{
    int timetaken,value,i;
    DATA(int u,int d,int ind){
        value=u,timetaken=d,i=ind;
    }
    DATA(){
        timetaken=1e9;
        value=1;
    }
    friend bool operator<(const DATA &a,const DATA&b){
        return a.timetaken*b.value<
                b.timetaken*a.value;
    }
};
priority_queue<DATA>pq;
vector<int>ord;
int deg[1<<18];
long long scheduling_cost(std::vector<int> p, std::vector<int> u, std::vector<int> d) {
    int N=p.size();
    for(int i=1;i<N;i++)
        deg[p[i]]++;
    for(int i=0;i<N;i++) if(!deg[i])
        pq.push(DATA(u[i],d[i],i));
    while(pq.size()){
        int K=pq.top().i;
        pq.pop();
        if(!--deg[p[K]])
            pq.push(DATA(u[p[K]],d[p[K]],p[K]));
        ord.push_back(K);
    }
    reverse(ord.begin(),ord.end());
    long long curtime=0,ans=0;
    for(auto i:ord)
        ans+=u[i]*(curtime+=d[i]);
    ord.clear();
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 11 ms 2140 KB Output is correct
6 Correct 28 ms 3788 KB Output is correct
7 Correct 29 ms 5580 KB Output is correct
8 Correct 43 ms 7004 KB Output is correct
9 Correct 39 ms 6860 KB Output is correct
10 Correct 42 ms 7016 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 39 ms 6868 KB Output is correct
13 Correct 38 ms 7016 KB Output is correct
14 Correct 38 ms 6860 KB Output is correct
15 Correct 38 ms 6860 KB Output is correct
16 Correct 38 ms 7004 KB Output is correct
17 Correct 39 ms 7116 KB Output is correct
18 Correct 39 ms 7012 KB Output is correct
19 Correct 41 ms 6860 KB Output is correct
20 Correct 41 ms 6860 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 62 ms 9556 KB Output is correct
5 Correct 67 ms 9160 KB Output is correct
6 Correct 70 ms 9672 KB Output is correct
7 Correct 65 ms 9248 KB Output is correct
8 Correct 65 ms 9664 KB Output is correct
9 Correct 63 ms 9120 KB Output is correct
10 Correct 63 ms 9156 KB Output is correct
11 Correct 67 ms 9060 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 3 ms 856 KB Output is correct
6 Correct 68 ms 9564 KB Output is correct
7 Correct 88 ms 9300 KB Output is correct
8 Correct 84 ms 9680 KB Output is correct
9 Correct 68 ms 9156 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 3 ms 860 KB Output is correct
13 Correct 4 ms 860 KB Output is correct
14 Correct 64 ms 9276 KB Output is correct
15 Correct 76 ms 9152 KB Output is correct
16 Correct 69 ms 9208 KB Output is correct
17 Correct 67 ms 9204 KB Output is correct
18 Correct 65 ms 9296 KB Output is correct
19 Correct 67 ms 9160 KB Output is correct
20 Correct 66 ms 9156 KB Output is correct
21 Correct 64 ms 9152 KB Output is correct
22 Correct 70 ms 9160 KB Output is correct
23 Correct 71 ms 9152 KB Output is correct
24 Correct 65 ms 9672 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 11 ms 2140 KB Output is correct
6 Correct 28 ms 3788 KB Output is correct
7 Correct 29 ms 5580 KB Output is correct
8 Correct 43 ms 7004 KB Output is correct
9 Correct 39 ms 6860 KB Output is correct
10 Correct 42 ms 7016 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 39 ms 6868 KB Output is correct
13 Correct 38 ms 7016 KB Output is correct
14 Correct 38 ms 6860 KB Output is correct
15 Correct 38 ms 6860 KB Output is correct
16 Correct 38 ms 7004 KB Output is correct
17 Correct 39 ms 7116 KB Output is correct
18 Correct 39 ms 7012 KB Output is correct
19 Correct 41 ms 6860 KB Output is correct
20 Correct 41 ms 6860 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 62 ms 9556 KB Output is correct
25 Correct 67 ms 9160 KB Output is correct
26 Correct 70 ms 9672 KB Output is correct
27 Correct 65 ms 9248 KB Output is correct
28 Correct 65 ms 9664 KB Output is correct
29 Correct 63 ms 9120 KB Output is correct
30 Correct 63 ms 9156 KB Output is correct
31 Correct 67 ms 9060 KB Output is correct
32 Correct 1 ms 344 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 3 ms 856 KB Output is correct
37 Correct 68 ms 9564 KB Output is correct
38 Correct 88 ms 9300 KB Output is correct
39 Correct 84 ms 9680 KB Output is correct
40 Correct 68 ms 9156 KB Output is correct
41 Correct 0 ms 344 KB Output is correct
42 Correct 1 ms 344 KB Output is correct
43 Correct 3 ms 860 KB Output is correct
44 Correct 4 ms 860 KB Output is correct
45 Correct 64 ms 9276 KB Output is correct
46 Correct 76 ms 9152 KB Output is correct
47 Correct 69 ms 9208 KB Output is correct
48 Correct 67 ms 9204 KB Output is correct
49 Correct 65 ms 9296 KB Output is correct
50 Correct 67 ms 9160 KB Output is correct
51 Correct 66 ms 9156 KB Output is correct
52 Correct 64 ms 9152 KB Output is correct
53 Correct 70 ms 9160 KB Output is correct
54 Correct 71 ms 9152 KB Output is correct
55 Correct 65 ms 9672 KB Output is correct
56 Incorrect 0 ms 348 KB Output isn't correct
57 Halted 0 ms 0 KB -