답안 #906321

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
906321 2024-01-14T01:10:02 Z vjudge1 Job Scheduling (IOI19_job) C++17
5 / 100
52 ms 5328 KB
#include "job.h"
#include <bits/stdc++.h>
using namespace std;

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define F first
#define S second
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

long long scheduling_cost(std::vector<int> p, std::vector<int> u, std::vector<int> d) {
	int n = sz(p);
	bool g1=true;
	bool g2=true;
	rep(i,1,n){
		if(p[i]!=i-1)g1=false;
		if(p[i]!=0)g2=false;
	}
	ll score = 0;
	if(g1){
		ll time = 0;
		rep(i,0,n){
			time += d[i];
			score += time*u[i];
		}
	}else if(g2){
		ll time = 0;
		score += d[0]*u[0];
		time += d[0];
		vi inds(n-1);iota(all(inds),1);
		sort(all(inds), [&](int a, int b){
			return (d[a]*u[b])<(d[b]*d[a]);
		});
		// cout<<score<<endl;
		rep(i,0,n-1){
			int j = inds[i];
			time += d[j];
			score += u[j] * time;
			// cout<<score<<endl;
		}
	}else{
		assert(false);
	}
	return score;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 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 11 ms 1372 KB Output is correct
6 Correct 22 ms 2760 KB Output is correct
7 Correct 34 ms 3912 KB Output is correct
8 Correct 43 ms 4944 KB Output is correct
9 Correct 42 ms 5080 KB Output is correct
10 Correct 52 ms 4948 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 43 ms 5044 KB Output is correct
13 Correct 43 ms 5328 KB Output is correct
14 Correct 44 ms 5072 KB Output is correct
15 Correct 43 ms 4944 KB Output is correct
16 Correct 43 ms 4956 KB Output is correct
17 Correct 43 ms 4944 KB Output is correct
18 Correct 47 ms 4948 KB Output is correct
19 Correct 43 ms 5256 KB Output is correct
20 Correct 44 ms 4948 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 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 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 11 ms 1372 KB Output is correct
6 Correct 22 ms 2760 KB Output is correct
7 Correct 34 ms 3912 KB Output is correct
8 Correct 43 ms 4944 KB Output is correct
9 Correct 42 ms 5080 KB Output is correct
10 Correct 52 ms 4948 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 43 ms 5044 KB Output is correct
13 Correct 43 ms 5328 KB Output is correct
14 Correct 44 ms 5072 KB Output is correct
15 Correct 43 ms 4944 KB Output is correct
16 Correct 43 ms 4956 KB Output is correct
17 Correct 43 ms 4944 KB Output is correct
18 Correct 47 ms 4948 KB Output is correct
19 Correct 43 ms 5256 KB Output is correct
20 Correct 44 ms 4948 KB Output is correct
21 Incorrect 0 ms 344 KB Output isn't correct
22 Halted 0 ms 0 KB -