답안 #314781

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
314781 2020-10-21T07:28:25 Z blue Job Scheduling (IOI19_job) C++17
7 / 100
96 ms 6776 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+1);
    return res;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 1 ms 512 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 88 ms 6776 KB Output is correct
5 Correct 89 ms 6776 KB Output is correct
6 Correct 96 ms 6776 KB Output is correct
7 Correct 87 ms 6776 KB Output is correct
8 Correct 90 ms 6776 KB Output is correct
9 Correct 88 ms 6756 KB Output is correct
10 Correct 86 ms 6776 KB Output is correct
11 Correct 87 ms 6776 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -