답안 #293067

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
293067 2020-09-07T15:56:00 Z Autoratch Job Scheduling (IOI19_job) C++14
24 / 100
155 ms 14952 KB
#include "job.h"
#include <bits/stdc++.h>
using namespace std;

const int N = 2e5 + 1;

int n;
vector<int> adj[N],rev;
bool visited[N];
priority_queue<pair<double,int> > q;
long long now,ans;

long long scheduling_cost(vector<int> p,vector<int> u,vector<int> d)
{
    n = p.size();
    for(int i = 0;i < n;i++) q.push({-(double)d[i]/(double)u[i],i});
    while(!q.empty())
    {
        int x = q.top().second;
        q.pop();
        rev.clear();
        while(x!=-1 and !visited[x]) rev.push_back(x),x = p[x];
        reverse(rev.begin(),rev.end());
        for(int x : rev) now+=(long long)d[x],ans+=now*(long long)u[x],visited[x] = true;
    }
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 4992 KB Output is correct
2 Correct 3 ms 4992 KB Output is correct
3 Correct 4 ms 4992 KB Output is correct
4 Correct 4 ms 5120 KB Output is correct
5 Correct 37 ms 7416 KB Output is correct
6 Correct 70 ms 9580 KB Output is correct
7 Correct 107 ms 12844 KB Output is correct
8 Correct 143 ms 14692 KB Output is correct
9 Correct 142 ms 14100 KB Output is correct
10 Correct 144 ms 13956 KB Output is correct
11 Correct 3 ms 4992 KB Output is correct
12 Correct 140 ms 14052 KB Output is correct
13 Correct 143 ms 14952 KB Output is correct
14 Correct 139 ms 13928 KB Output is correct
15 Correct 133 ms 14824 KB Output is correct
16 Correct 135 ms 13928 KB Output is correct
17 Correct 141 ms 14104 KB Output is correct
18 Correct 141 ms 14052 KB Output is correct
19 Correct 126 ms 14836 KB Output is correct
20 Correct 125 ms 13928 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 4992 KB Output is correct
2 Correct 4 ms 4992 KB Output is correct
3 Correct 4 ms 4992 KB Output is correct
4 Correct 136 ms 13928 KB Output is correct
5 Correct 138 ms 13928 KB Output is correct
6 Correct 139 ms 14056 KB Output is correct
7 Correct 136 ms 13928 KB Output is correct
8 Correct 155 ms 13928 KB Output is correct
9 Correct 139 ms 13928 KB Output is correct
10 Correct 144 ms 13932 KB Output is correct
11 Correct 140 ms 13932 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 4992 KB Output is correct
2 Correct 3 ms 4992 KB Output is correct
3 Correct 4 ms 4992 KB Output is correct
4 Correct 4 ms 5120 KB Output is correct
5 Correct 10 ms 5632 KB Output is correct
6 Correct 142 ms 13928 KB Output is correct
7 Correct 143 ms 13928 KB Output is correct
8 Correct 139 ms 13928 KB Output is correct
9 Correct 143 ms 14056 KB Output is correct
10 Correct 4 ms 4992 KB Output is correct
11 Correct 4 ms 5120 KB Output is correct
12 Correct 9 ms 5632 KB Output is correct
13 Correct 10 ms 5632 KB Output is correct
14 Correct 144 ms 13928 KB Output is correct
15 Correct 145 ms 14056 KB Output is correct
16 Correct 139 ms 13928 KB Output is correct
17 Correct 140 ms 13928 KB Output is correct
18 Correct 152 ms 14056 KB Output is correct
19 Correct 152 ms 13924 KB Output is correct
20 Correct 144 ms 13928 KB Output is correct
21 Correct 140 ms 13904 KB Output is correct
22 Correct 144 ms 14056 KB Output is correct
23 Correct 143 ms 13928 KB Output is correct
24 Correct 145 ms 13928 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 4992 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 4992 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 4992 KB Output is correct
2 Correct 3 ms 4992 KB Output is correct
3 Correct 4 ms 4992 KB Output is correct
4 Correct 4 ms 5120 KB Output is correct
5 Correct 37 ms 7416 KB Output is correct
6 Correct 70 ms 9580 KB Output is correct
7 Correct 107 ms 12844 KB Output is correct
8 Correct 143 ms 14692 KB Output is correct
9 Correct 142 ms 14100 KB Output is correct
10 Correct 144 ms 13956 KB Output is correct
11 Correct 3 ms 4992 KB Output is correct
12 Correct 140 ms 14052 KB Output is correct
13 Correct 143 ms 14952 KB Output is correct
14 Correct 139 ms 13928 KB Output is correct
15 Correct 133 ms 14824 KB Output is correct
16 Correct 135 ms 13928 KB Output is correct
17 Correct 141 ms 14104 KB Output is correct
18 Correct 141 ms 14052 KB Output is correct
19 Correct 126 ms 14836 KB Output is correct
20 Correct 125 ms 13928 KB Output is correct
21 Correct 4 ms 4992 KB Output is correct
22 Correct 4 ms 4992 KB Output is correct
23 Correct 4 ms 4992 KB Output is correct
24 Correct 136 ms 13928 KB Output is correct
25 Correct 138 ms 13928 KB Output is correct
26 Correct 139 ms 14056 KB Output is correct
27 Correct 136 ms 13928 KB Output is correct
28 Correct 155 ms 13928 KB Output is correct
29 Correct 139 ms 13928 KB Output is correct
30 Correct 144 ms 13932 KB Output is correct
31 Correct 140 ms 13932 KB Output is correct
32 Correct 4 ms 4992 KB Output is correct
33 Correct 3 ms 4992 KB Output is correct
34 Correct 4 ms 4992 KB Output is correct
35 Correct 4 ms 5120 KB Output is correct
36 Correct 10 ms 5632 KB Output is correct
37 Correct 142 ms 13928 KB Output is correct
38 Correct 143 ms 13928 KB Output is correct
39 Correct 139 ms 13928 KB Output is correct
40 Correct 143 ms 14056 KB Output is correct
41 Correct 4 ms 4992 KB Output is correct
42 Correct 4 ms 5120 KB Output is correct
43 Correct 9 ms 5632 KB Output is correct
44 Correct 10 ms 5632 KB Output is correct
45 Correct 144 ms 13928 KB Output is correct
46 Correct 145 ms 14056 KB Output is correct
47 Correct 139 ms 13928 KB Output is correct
48 Correct 140 ms 13928 KB Output is correct
49 Correct 152 ms 14056 KB Output is correct
50 Correct 152 ms 13924 KB Output is correct
51 Correct 144 ms 13928 KB Output is correct
52 Correct 140 ms 13904 KB Output is correct
53 Correct 144 ms 14056 KB Output is correct
54 Correct 143 ms 13928 KB Output is correct
55 Correct 145 ms 13928 KB Output is correct
56 Incorrect 4 ms 4992 KB Output isn't correct
57 Halted 0 ms 0 KB -