Submission #314780

# Submission time Handle Problem Language Result Execution time Memory
314780 2020-10-21T07:27:38 Z blue Job Scheduling (IOI19_job) C++17
0 / 100
1 ms 384 KB
#include "job.h"
#include <vector>
#include <algorithm>
using namespace std;

//p = parent, d = duration, u = cost (when multiplied by time)

//5 pts: p[i] = i-1
/*
long long scheduling_cost(vector<int> p, vector<int> u, vector<int> d) {
    long long res = 0;
    int n = p.size();
    long long t = 0;
    for(int i = 0; i < n; i++)
    {
        t += d[i];
        res += t * u[i];
    }
	return res;
}
*/

//7 pts: p[i] = 0, d[i] = 1

long long scheduling_cost(vector<int> p, vector<int> u, vector<int> d) {
    long long res = 0;
    int n = p.size();
    res += u[0];
    u[0] = -1;
    sort(u.begin(), u.end());
    for(int i = n-1; i >= 1; i--) res += u[i] * (n-i);
    return res;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -