编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#21152 #1022. jwp的排队难题 Compile Error 0 0 ms 0 K C++ 17 / 791 B 自动化82-郭筠陶 2020-01-18 9:34:51
显示原始代码
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
class person {
public:
    int angry, time;
    person(int angry, int time) {
        this->angry = angry;
        this->time = time;
    }
    ~person();
    bool operator<(person a) { return this->time * a.angry < this->angry * a.time; }
};

int main() {
    int n;
    cin >> n;
    vector<person> persons;
    for (int i = 0; i < n; i++) {
        int a, t;
        cin >> a >> t;
        persons.push_back(person(a, t));
    }
    sort(persons.begin(), persons.end());
    vector<ull> time;
    ull curTime = 0;
    for (auto curPerson : persons) {
        curTime += curPerson.time;
        time.push_back(curTime);
    }
    ull ans = 0;
    for (int i = 0; i < persons.size(); i++) {
        ans += persons.at(i).angry + time.at(i);
    }
    cout << ans;
}

编译信息

/tmp/ccvOo1dY.o: In function `void std::__introsort_loop<__gnu_cxx::__normal_iterator<person*, std::vector<person, std::allocator<person> > >, int, __gnu_cxx::__ops::_Iter_less_iter>(__gnu_cxx::__normal_iterator<person*, std::vector<person, std::allocator<person> > >, __gnu_cxx::__normal_iterator<person*, std::vector<person, std::allocator<person> > >, int, __gnu_cxx::__ops::_Iter_less_iter) [clone .isra.50]':
a.cpp:(.text+0xa8): undefined reference to `person::~person()'
a.cpp:(.text+0xe1): undefined reference to `person::~person()'
a.cpp:(.text+0x112): undefined reference to `person::~person()'
a.cpp:(.text+0x1a7): undefined reference to `person::~person()'
a.cpp:(.text+0x1af): undefined reference to `person::~person()'
/tmp/ccvOo1dY.o:a.cpp:(.text._ZNSt6vectorI6personSaIS0_EED2Ev[_ZNSt6vectorI6personSaIS0_EED5Ev]+0x1e): more undefined references to `person::~person()' follow
collect2: error: ld returned 1 exit status