답안 #307998

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
307998 2020-09-29T17:45:40 Z urd05 Job Scheduling (IOI19_job) C++14
24 / 100
116 ms 11752 KB
#include "job.h"
#include <bits/stdc++.h>
using namespace std;

typedef pair<long long,long long> P;

bool comp(P a,P b) {
    return a.first*b.second<b.first*a.second;
}

long long scheduling_cost(vector<int> p,vector<int> u,vector<int> d) {
    int n=p.size();
    if (n>2&&p[2]!=0) {
        long long ret=0;
        long long t=0;
        for(int i=0;i<n;i++) {
            t+=d[i];
            ret+=t*u[i];
        }
        return ret;
    }
    vector<P> v;
    for(int i=1;i<n;i++) {
        v.push_back(P(d[i],u[i]));
    }
    sort(v.begin(),v.end(),comp);
    long long ret=u[0]*d[0];
    long long t=d[0];
    for(int i=0;i<v.size();i++) {
        t+=v[i].first;
        ret+=t*v[i].second;
    }
	return ret;
}

Compilation message

job.cpp: In function 'long long int scheduling_cost(std::vector<int>, std::vector<int>, std::vector<int>)':
job.cpp:29:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |     for(int i=0;i<v.size();i++) {
      |                 ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 23 ms 2304 KB Output is correct
6 Correct 45 ms 4216 KB Output is correct
7 Correct 69 ms 6392 KB Output is correct
8 Correct 92 ms 8312 KB Output is correct
9 Correct 89 ms 8184 KB Output is correct
10 Correct 90 ms 8184 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 93 ms 8312 KB Output is correct
13 Correct 96 ms 8232 KB Output is correct
14 Correct 91 ms 8184 KB Output is correct
15 Correct 89 ms 8184 KB Output is correct
16 Correct 99 ms 8200 KB Output is correct
17 Correct 90 ms 8232 KB Output is correct
18 Correct 90 ms 8184 KB Output is correct
19 Correct 90 ms 8184 KB Output is correct
20 Correct 96 ms 8184 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 107 ms 10984 KB Output is correct
5 Correct 98 ms 10984 KB Output is correct
6 Correct 101 ms 10984 KB Output is correct
7 Correct 100 ms 10984 KB Output is correct
8 Correct 97 ms 10992 KB Output is correct
9 Correct 99 ms 10988 KB Output is correct
10 Correct 101 ms 11112 KB Output is correct
11 Correct 101 ms 10984 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 6 ms 1024 KB Output is correct
6 Correct 110 ms 11624 KB Output is correct
7 Correct 112 ms 11624 KB Output is correct
8 Correct 113 ms 11624 KB Output is correct
9 Correct 112 ms 11624 KB Output is correct
10 Correct 1 ms 376 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 5 ms 1024 KB Output is correct
13 Correct 6 ms 1024 KB Output is correct
14 Correct 109 ms 11624 KB Output is correct
15 Correct 115 ms 11624 KB Output is correct
16 Correct 109 ms 11544 KB Output is correct
17 Correct 110 ms 11624 KB Output is correct
18 Correct 112 ms 11528 KB Output is correct
19 Correct 111 ms 11624 KB Output is correct
20 Correct 116 ms 11752 KB Output is correct
21 Correct 111 ms 11624 KB Output is correct
22 Correct 115 ms 11652 KB Output is correct
23 Correct 113 ms 11624 KB Output is correct
24 Correct 110 ms 11624 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 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 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 23 ms 2304 KB Output is correct
6 Correct 45 ms 4216 KB Output is correct
7 Correct 69 ms 6392 KB Output is correct
8 Correct 92 ms 8312 KB Output is correct
9 Correct 89 ms 8184 KB Output is correct
10 Correct 90 ms 8184 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 93 ms 8312 KB Output is correct
13 Correct 96 ms 8232 KB Output is correct
14 Correct 91 ms 8184 KB Output is correct
15 Correct 89 ms 8184 KB Output is correct
16 Correct 99 ms 8200 KB Output is correct
17 Correct 90 ms 8232 KB Output is correct
18 Correct 90 ms 8184 KB Output is correct
19 Correct 90 ms 8184 KB Output is correct
20 Correct 96 ms 8184 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 1 ms 256 KB Output is correct
23 Correct 1 ms 256 KB Output is correct
24 Correct 107 ms 10984 KB Output is correct
25 Correct 98 ms 10984 KB Output is correct
26 Correct 101 ms 10984 KB Output is correct
27 Correct 100 ms 10984 KB Output is correct
28 Correct 97 ms 10992 KB Output is correct
29 Correct 99 ms 10988 KB Output is correct
30 Correct 101 ms 11112 KB Output is correct
31 Correct 101 ms 10984 KB Output is correct
32 Correct 1 ms 256 KB Output is correct
33 Correct 0 ms 256 KB Output is correct
34 Correct 1 ms 256 KB Output is correct
35 Correct 1 ms 384 KB Output is correct
36 Correct 6 ms 1024 KB Output is correct
37 Correct 110 ms 11624 KB Output is correct
38 Correct 112 ms 11624 KB Output is correct
39 Correct 113 ms 11624 KB Output is correct
40 Correct 112 ms 11624 KB Output is correct
41 Correct 1 ms 376 KB Output is correct
42 Correct 1 ms 384 KB Output is correct
43 Correct 5 ms 1024 KB Output is correct
44 Correct 6 ms 1024 KB Output is correct
45 Correct 109 ms 11624 KB Output is correct
46 Correct 115 ms 11624 KB Output is correct
47 Correct 109 ms 11544 KB Output is correct
48 Correct 110 ms 11624 KB Output is correct
49 Correct 112 ms 11528 KB Output is correct
50 Correct 111 ms 11624 KB Output is correct
51 Correct 116 ms 11752 KB Output is correct
52 Correct 111 ms 11624 KB Output is correct
53 Correct 115 ms 11652 KB Output is correct
54 Correct 113 ms 11624 KB Output is correct
55 Correct 110 ms 11624 KB Output is correct
56 Incorrect 1 ms 256 KB Output isn't correct
57 Halted 0 ms 0 KB -