# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
494428 | 2021-12-15T12:23:06 Z | SuckTinHock | Job Scheduling (IOI19_job) | C++17 | 0 ms | 0 KB |
#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; }