답안 #906312

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
906312 2024-01-14T00:52:35 Z vjudge1 Job Scheduling (IOI19_job) C++17
24 / 100
78 ms 9008 KB
#include "job.h"
#include <vector>

#pragma GCC target ("avx2")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")

#include<bits/stdc++.h>
#include<math.h>
using namespace std;

typedef long long int ll;
typedef long double ld;
typedef pair<ll, ll> pl;
typedef vector<ll> vl;
#define FD(i, r, l) for(ll i = r; i > (l); --i)

#define K first
#define V second
#define G(x) ll x; cin >> x;
#define GD(x) ld x; cin >> x;
#define GS(s) string s; cin >> s;
#define EX(x) { cout << x << '\n'; exit(0); }
#define A(a) (a).begin(), (a).end()
#define F(i, l, r) for (ll i = l; i < (r); ++i)

#define NN
#define M 1000000007 // 998244353


long long scheduling_cost(std::vector<int> p, std::vector<int> u, std::vector<int> d) {
    ll ans = 0;
    int n = (int)p.size();
    bool case1 = true,case2 = true;


    for(int i=1;i<n;i++){
        case1 &= p[i]==i-1;

        case2 &= p[i]==0;
        case2 &= d[i]==1;
    }

    if(case1){
        ll time = 0;
        for(int i=0;i<n;i++){
            time += d[i];
            ans += time*u[i];
        }
        return ans;
    }

    if(case2 or 1){
        ll time = d[0];
        ans += time*u[0];

        vl ord(n-1); iota(ord.begin(),ord.end(),1);

        sort(ord.begin(),ord.end(), [&](int i,int j){
            return -u[i]*d[j] < -u[j]*d[i];
        });

        for(auto i : ord){
            time += d[i];
            ans += time*u[i];
        }

        return ans;
    }

    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 12 ms 1372 KB Output is correct
6 Correct 22 ms 2652 KB Output is correct
7 Correct 38 ms 3924 KB Output is correct
8 Correct 45 ms 4944 KB Output is correct
9 Correct 50 ms 4948 KB Output is correct
10 Correct 44 ms 5092 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 45 ms 5064 KB Output is correct
13 Correct 45 ms 5104 KB Output is correct
14 Correct 45 ms 5080 KB Output is correct
15 Correct 44 ms 4948 KB Output is correct
16 Correct 46 ms 4948 KB Output is correct
17 Correct 45 ms 4948 KB Output is correct
18 Correct 45 ms 5080 KB Output is correct
19 Correct 45 ms 4952 KB Output is correct
20 Correct 46 ms 5044 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 61 ms 6484 KB Output is correct
5 Correct 62 ms 6480 KB Output is correct
6 Correct 61 ms 6620 KB Output is correct
7 Correct 60 ms 6484 KB Output is correct
8 Correct 61 ms 6700 KB Output is correct
9 Correct 60 ms 6480 KB Output is correct
10 Correct 62 ms 6596 KB Output is correct
11 Correct 61 ms 6700 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 3 ms 604 KB Output is correct
6 Correct 66 ms 8796 KB Output is correct
7 Correct 68 ms 8788 KB Output is correct
8 Correct 67 ms 8800 KB Output is correct
9 Correct 67 ms 8792 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 3 ms 604 KB Output is correct
13 Correct 4 ms 700 KB Output is correct
14 Correct 78 ms 8776 KB Output is correct
15 Correct 67 ms 8788 KB Output is correct
16 Correct 67 ms 8788 KB Output is correct
17 Correct 67 ms 8908 KB Output is correct
18 Correct 67 ms 8988 KB Output is correct
19 Correct 67 ms 8784 KB Output is correct
20 Correct 73 ms 9008 KB Output is correct
21 Correct 66 ms 8788 KB Output is correct
22 Correct 69 ms 8908 KB Output is correct
23 Correct 68 ms 8788 KB Output is correct
24 Correct 67 ms 8956 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 12 ms 1372 KB Output is correct
6 Correct 22 ms 2652 KB Output is correct
7 Correct 38 ms 3924 KB Output is correct
8 Correct 45 ms 4944 KB Output is correct
9 Correct 50 ms 4948 KB Output is correct
10 Correct 44 ms 5092 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 45 ms 5064 KB Output is correct
13 Correct 45 ms 5104 KB Output is correct
14 Correct 45 ms 5080 KB Output is correct
15 Correct 44 ms 4948 KB Output is correct
16 Correct 46 ms 4948 KB Output is correct
17 Correct 45 ms 4948 KB Output is correct
18 Correct 45 ms 5080 KB Output is correct
19 Correct 45 ms 4952 KB Output is correct
20 Correct 46 ms 5044 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 61 ms 6484 KB Output is correct
25 Correct 62 ms 6480 KB Output is correct
26 Correct 61 ms 6620 KB Output is correct
27 Correct 60 ms 6484 KB Output is correct
28 Correct 61 ms 6700 KB Output is correct
29 Correct 60 ms 6480 KB Output is correct
30 Correct 62 ms 6596 KB Output is correct
31 Correct 61 ms 6700 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 1 ms 348 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 3 ms 604 KB Output is correct
37 Correct 66 ms 8796 KB Output is correct
38 Correct 68 ms 8788 KB Output is correct
39 Correct 67 ms 8800 KB Output is correct
40 Correct 67 ms 8792 KB Output is correct
41 Correct 1 ms 348 KB Output is correct
42 Correct 1 ms 348 KB Output is correct
43 Correct 3 ms 604 KB Output is correct
44 Correct 4 ms 700 KB Output is correct
45 Correct 78 ms 8776 KB Output is correct
46 Correct 67 ms 8788 KB Output is correct
47 Correct 67 ms 8788 KB Output is correct
48 Correct 67 ms 8908 KB Output is correct
49 Correct 67 ms 8988 KB Output is correct
50 Correct 67 ms 8784 KB Output is correct
51 Correct 73 ms 9008 KB Output is correct
52 Correct 66 ms 8788 KB Output is correct
53 Correct 69 ms 8908 KB Output is correct
54 Correct 68 ms 8788 KB Output is correct
55 Correct 67 ms 8956 KB Output is correct
56 Incorrect 0 ms 344 KB Output isn't correct
57 Halted 0 ms 0 KB -