Submission #1060773

# Submission time Handle Problem Language Result Execution time Memory
1060773 2024-08-15T22:29:59 Z vjudge1 Job Scheduling (IOI19_job) C++17
24 / 100
70 ms 12228 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;
}
# Verdict Execution time Memory Grader output
1 Correct 0 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 10 ms 2908 KB Output is correct
6 Correct 19 ms 5328 KB Output is correct
7 Correct 30 ms 7884 KB Output is correct
8 Correct 43 ms 10028 KB Output is correct
9 Correct 39 ms 10204 KB Output is correct
10 Correct 40 ms 10188 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 44 ms 10044 KB Output is correct
13 Correct 39 ms 10188 KB Output is correct
14 Correct 46 ms 10192 KB Output is correct
15 Correct 38 ms 10188 KB Output is correct
16 Correct 39 ms 10188 KB Output is correct
17 Correct 38 ms 10192 KB Output is correct
18 Correct 39 ms 10136 KB Output is correct
19 Correct 38 ms 10060 KB Output is correct
20 Correct 44 ms 10192 KB Output is correct
# Verdict Execution time Memory 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 64 ms 10892 KB Output is correct
5 Correct 67 ms 10952 KB Output is correct
6 Correct 65 ms 10820 KB Output is correct
7 Correct 64 ms 10820 KB Output is correct
8 Correct 63 ms 10952 KB Output is correct
9 Correct 64 ms 10952 KB Output is correct
10 Correct 62 ms 11104 KB Output is correct
11 Correct 65 ms 10952 KB Output is correct
# Verdict Execution time Memory 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 1 ms 348 KB Output is correct
5 Correct 3 ms 1040 KB Output is correct
6 Correct 67 ms 11980 KB Output is correct
7 Correct 66 ms 11464 KB Output is correct
8 Correct 64 ms 11464 KB Output is correct
9 Correct 64 ms 11556 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 3 ms 860 KB Output is correct
13 Correct 4 ms 860 KB Output is correct
14 Correct 68 ms 11460 KB Output is correct
15 Correct 68 ms 12196 KB Output is correct
16 Correct 69 ms 11464 KB Output is correct
17 Correct 67 ms 11464 KB Output is correct
18 Correct 66 ms 12228 KB Output is correct
19 Correct 69 ms 11720 KB Output is correct
20 Correct 66 ms 11568 KB Output is correct
21 Correct 70 ms 11524 KB Output is correct
22 Correct 67 ms 11988 KB Output is correct
23 Correct 68 ms 11464 KB Output is correct
24 Correct 67 ms 11460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 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 10 ms 2908 KB Output is correct
6 Correct 19 ms 5328 KB Output is correct
7 Correct 30 ms 7884 KB Output is correct
8 Correct 43 ms 10028 KB Output is correct
9 Correct 39 ms 10204 KB Output is correct
10 Correct 40 ms 10188 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 44 ms 10044 KB Output is correct
13 Correct 39 ms 10188 KB Output is correct
14 Correct 46 ms 10192 KB Output is correct
15 Correct 38 ms 10188 KB Output is correct
16 Correct 39 ms 10188 KB Output is correct
17 Correct 38 ms 10192 KB Output is correct
18 Correct 39 ms 10136 KB Output is correct
19 Correct 38 ms 10060 KB Output is correct
20 Correct 44 ms 10192 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 64 ms 10892 KB Output is correct
25 Correct 67 ms 10952 KB Output is correct
26 Correct 65 ms 10820 KB Output is correct
27 Correct 64 ms 10820 KB Output is correct
28 Correct 63 ms 10952 KB Output is correct
29 Correct 64 ms 10952 KB Output is correct
30 Correct 62 ms 11104 KB Output is correct
31 Correct 65 ms 10952 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 3 ms 1040 KB Output is correct
37 Correct 67 ms 11980 KB Output is correct
38 Correct 66 ms 11464 KB Output is correct
39 Correct 64 ms 11464 KB Output is correct
40 Correct 64 ms 11556 KB Output is correct
41 Correct 0 ms 348 KB Output is correct
42 Correct 1 ms 348 KB Output is correct
43 Correct 3 ms 860 KB Output is correct
44 Correct 4 ms 860 KB Output is correct
45 Correct 68 ms 11460 KB Output is correct
46 Correct 68 ms 12196 KB Output is correct
47 Correct 69 ms 11464 KB Output is correct
48 Correct 67 ms 11464 KB Output is correct
49 Correct 66 ms 12228 KB Output is correct
50 Correct 69 ms 11720 KB Output is correct
51 Correct 66 ms 11568 KB Output is correct
52 Correct 70 ms 11524 KB Output is correct
53 Correct 67 ms 11988 KB Output is correct
54 Correct 68 ms 11464 KB Output is correct
55 Correct 67 ms 11460 KB Output is correct
56 Incorrect 0 ms 344 KB Output isn't correct
57 Halted 0 ms 0 KB -