Submission #313666

# Submission time Handle Problem Language Result Execution time Memory
313666 2020-10-16T14:23:35 Z MiricaMatei Job Scheduling (IOI19_job) C++14
24 / 100
152 ms 19324 KB
#include <bits/stdc++.h>

using namespace std;

const int MAXN = 200005;

vector<int>G[MAXN];

struct Obj {
  int i, u, d;
  bool operator <(const Obj& other) const {
    bool ans;
    if (u == 0) {
      ans = 0;
    } else {
      if (other.u == 0) {
        ans = 1;
      } else {
        if (1LL * d * other.u < 1LL * other.d * u)
          ans = 1;
        else
          ans = 0;
      }
    }
    return !ans;
  }
};

long long scheduling_cost(vector<int>p, vector<int>u, vector<int>d) {
  int n = p.size();
  for (int i = 1; i < n; ++i)
    G[p[i]].push_back(i);
  long long ans = 0;
  long long t = 0;
  priority_queue<Obj>pq;
  pq.push({0, u[0], d[0]});
  while (!pq.empty()) {
    Obj aux = pq.top();
    pq.pop();
    t += aux.d;
    ans += t * aux.u;
    for (auto it:G[aux.i])
      pq.push({it, u[it], d[it]});
  }
  return ans;
}

/*int main() {
  freopen("date.in", "r", stdin);
  freopen("date.out", "w", stdout);

  int n;
  scanf("%d", &n);
  vector<int>p(n), u(n), d(n);
  for (int i = 0; i < n; ++i)
    scanf("%d", &p[i]);
  for (int i = 0; i < n; ++i)
    scanf("%d", &u[i]);
  for (int i = 0; i < n; ++i)
    scanf("%d", &d[i]);

  printf("%lld\n", scheduling_cost(p, u, d));

  return 0;
}*/
# Verdict Execution time Memory 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 4 ms 5120 KB Output is correct
5 Correct 28 ms 8576 KB Output is correct
6 Correct 53 ms 12024 KB Output is correct
7 Correct 76 ms 15608 KB Output is correct
8 Correct 100 ms 19192 KB Output is correct
9 Correct 101 ms 19192 KB Output is correct
10 Correct 100 ms 19192 KB Output is correct
11 Correct 4 ms 4992 KB Output is correct
12 Correct 101 ms 19324 KB Output is correct
13 Correct 98 ms 19192 KB Output is correct
14 Correct 97 ms 19192 KB Output is correct
15 Correct 99 ms 19320 KB Output is correct
16 Correct 100 ms 19192 KB Output is correct
17 Correct 101 ms 19192 KB Output is correct
18 Correct 104 ms 19192 KB Output is correct
19 Correct 99 ms 19192 KB Output is correct
20 Correct 101 ms 19320 KB Output is correct
# Verdict Execution time Memory 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 142 ms 16080 KB Output is correct
5 Correct 138 ms 16104 KB Output is correct
6 Correct 137 ms 16104 KB Output is correct
7 Correct 141 ms 16136 KB Output is correct
8 Correct 137 ms 16104 KB Output is correct
9 Correct 138 ms 16104 KB Output is correct
10 Correct 140 ms 16104 KB Output is correct
11 Correct 139 ms 16104 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 4992 KB Output is correct
2 Correct 4 ms 4992 KB Output is correct
3 Correct 4 ms 5068 KB Output is correct
4 Correct 4 ms 5120 KB Output is correct
5 Correct 9 ms 5760 KB Output is correct
6 Correct 145 ms 16872 KB Output is correct
7 Correct 142 ms 16744 KB Output is correct
8 Correct 145 ms 16744 KB Output is correct
9 Correct 146 ms 16744 KB Output is correct
10 Correct 4 ms 4992 KB Output is correct
11 Correct 4 ms 5120 KB Output is correct
12 Correct 8 ms 5632 KB Output is correct
13 Correct 10 ms 5760 KB Output is correct
14 Correct 152 ms 16676 KB Output is correct
15 Correct 142 ms 16744 KB Output is correct
16 Correct 144 ms 16744 KB Output is correct
17 Correct 147 ms 16736 KB Output is correct
18 Correct 142 ms 16744 KB Output is correct
19 Correct 142 ms 16620 KB Output is correct
20 Correct 148 ms 16620 KB Output is correct
21 Correct 146 ms 16744 KB Output is correct
22 Correct 147 ms 16744 KB Output is correct
23 Correct 145 ms 16744 KB Output is correct
24 Correct 149 ms 16744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 4992 KB Output is correct
2 Incorrect 102 ms 19244 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 4992 KB Output is correct
2 Incorrect 4 ms 4992 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 4 ms 5120 KB Output is correct
5 Correct 28 ms 8576 KB Output is correct
6 Correct 53 ms 12024 KB Output is correct
7 Correct 76 ms 15608 KB Output is correct
8 Correct 100 ms 19192 KB Output is correct
9 Correct 101 ms 19192 KB Output is correct
10 Correct 100 ms 19192 KB Output is correct
11 Correct 4 ms 4992 KB Output is correct
12 Correct 101 ms 19324 KB Output is correct
13 Correct 98 ms 19192 KB Output is correct
14 Correct 97 ms 19192 KB Output is correct
15 Correct 99 ms 19320 KB Output is correct
16 Correct 100 ms 19192 KB Output is correct
17 Correct 101 ms 19192 KB Output is correct
18 Correct 104 ms 19192 KB Output is correct
19 Correct 99 ms 19192 KB Output is correct
20 Correct 101 ms 19320 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 142 ms 16080 KB Output is correct
25 Correct 138 ms 16104 KB Output is correct
26 Correct 137 ms 16104 KB Output is correct
27 Correct 141 ms 16136 KB Output is correct
28 Correct 137 ms 16104 KB Output is correct
29 Correct 138 ms 16104 KB Output is correct
30 Correct 140 ms 16104 KB Output is correct
31 Correct 139 ms 16104 KB Output is correct
32 Correct 4 ms 4992 KB Output is correct
33 Correct 4 ms 4992 KB Output is correct
34 Correct 4 ms 5068 KB Output is correct
35 Correct 4 ms 5120 KB Output is correct
36 Correct 9 ms 5760 KB Output is correct
37 Correct 145 ms 16872 KB Output is correct
38 Correct 142 ms 16744 KB Output is correct
39 Correct 145 ms 16744 KB Output is correct
40 Correct 146 ms 16744 KB Output is correct
41 Correct 4 ms 4992 KB Output is correct
42 Correct 4 ms 5120 KB Output is correct
43 Correct 8 ms 5632 KB Output is correct
44 Correct 10 ms 5760 KB Output is correct
45 Correct 152 ms 16676 KB Output is correct
46 Correct 142 ms 16744 KB Output is correct
47 Correct 144 ms 16744 KB Output is correct
48 Correct 147 ms 16736 KB Output is correct
49 Correct 142 ms 16744 KB Output is correct
50 Correct 142 ms 16620 KB Output is correct
51 Correct 148 ms 16620 KB Output is correct
52 Correct 146 ms 16744 KB Output is correct
53 Correct 147 ms 16744 KB Output is correct
54 Correct 145 ms 16744 KB Output is correct
55 Correct 149 ms 16744 KB Output is correct
56 Correct 4 ms 4992 KB Output is correct
57 Incorrect 102 ms 19244 KB Output isn't correct
58 Halted 0 ms 0 KB -