답안 #494426

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
494426 2021-12-15T12:22:32 Z SuckTinHock Job Scheduling (IOI19_job) C++14
컴파일 오류
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;
}

Compilation message

/usr/bin/ld: /tmp/cc9sfZIM.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc1BiWFP.o:job.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/cc9sfZIM.o: in function `main':
grader.cpp:(.text.startup+0x2b1): undefined reference to `scheduling_cost(std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status