# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
494426 | SuckTinHock | Job Scheduling (IOI19_job) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pi;
const ll MOD = 1e9 + 7;
const double PI = cos(-1);
const ll INF = 1e16;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll n;
struct node
{
ll p, w, t;
}A[200005];
bool cmp(node A, node B)
{
if (A.p == B.p)
{
return (double)(A.w / A.t) > (double)(B.w > B.t);
}
return A.p < B.p;
}
void xuly()
{
ll res = 0, pre = 0;
sort(A+1,A+n+1,cmp);
for (ll i = 1; i <= n; ++i)
{
pre += A[i].t;
res += pre * (A[i].w);
}
cout << res;
}
void nhap()
{
cin >> n;
for (ll i = 1; i <= n; ++i) cin >> A[i].p;
for (ll i = 1; i <= n; ++i) cin >> A[i].w;
for (ll i = 1; i <= n; ++i) cin >> A[i].t;
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
//freopen("IJOB.INP","r",stdin);
//freopen("IJOB.OUT","w",stdout);
//int T; cin >> T;
//while (T--)
//{
nhap();
xuly();
//}
return 0;
}