답안 #865960

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
865960 2023-10-25T05:49:37 Z SorahISA Job Scheduling (IOI19_job) C++17
21 / 100
3000 ms 8904 KB
#include "job.h"
#include <bits/stdc++.h>
using namespace std;

using int64 = long long;

int64 scheduling_cost(vector<int> p, vector<int> u, vector<int> d) {
    int N = p.size();
    vector<int> alive(N, 1);
    
    int64 tim = 0, ans = 0;
    for (int _round = 0; _round < N; ++_round) {
        
        int id = -1;
        for (int i = 0; i < N; ++i) {
            if (alive[i] and (id == -1 or int64(d[i]) * u[id] < int64(d[id]) * u[i])) id = i;
        }
        
        if (p[id] == -1) {
            tim += d[id];
            ans += int64(u[id]) * tim;
        }
        else {
            ans -= int64(d[id]) * u[p[id]];
            d[p[id]] += d[id];
            u[p[id]] += u[id];
        }
        alive[id] = 0;
        
        for (int i = 0; i < N; ++i) {
            if (p[i] == id) p[i] = p[id];
        }
    }
    
    return ans;
}
# 결과 실행 시간 메모리 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 4 ms 348 KB Output is correct
5 Execution timed out 3045 ms 2556 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Execution timed out 3069 ms 7508 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 500 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 4 ms 348 KB Output is correct
5 Correct 320 ms 796 KB Output is correct
6 Execution timed out 3048 ms 8112 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Execution timed out 3091 ms 8904 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 436 KB Output is correct
16 Correct 1 ms 436 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 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 4 ms 348 KB Output is correct
5 Execution timed out 3045 ms 2556 KB Time limit exceeded
6 Halted 0 ms 0 KB -