Submission #314844

#TimeUsernameProblemLanguageResultExecution timeMemory
314844blueJob Scheduling (IOI19_job)C++17
Compilation error
0 ms0 KiB
#include "job.h" #include <vector> #include <algorithm> #include <set> using namespace std; struct job { long long u; long long d; vector<int> children; }; bool operator < (job A, job B) { return A.u*B.d > B.u*A.d; } long long scheduling_cost(vector<int> p, vector<int> u, vector<int> d) { long long res = 0; int n = p.size(); job J[n]; vector<int> v; for(int i = 0; i < n; i++) { J[i] = job{u[i], d[i], v}; if(i > 0) J[p[i]].children.push_back(i); } long long t = 0; set<job> S; S.insert(J[0]); job j; while(!S.empty()) { j = S.front(); S.erase(S.front()); for(int k: j.children) S.insert(J[k]); t += j.d; res += t * j.u; } return res; }

Compilation message (stderr)

job.cpp: In function 'long long int scheduling_cost(std::vector<int>, std::vector<int>, std::vector<int>)':
job.cpp:41:15: error: 'class std::set<job>' has no member named 'front'
   41 |         j = S.front();
      |               ^~~~~
job.cpp:42:19: error: 'class std::set<job>' has no member named 'front'
   42 |         S.erase(S.front());
      |                   ^~~~~