Submission #892035

#TimeUsernameProblemLanguageResultExecution timeMemory
892035MihailoFun Tour (APIO20_fun)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "fun.h" #define mp make_pair using namespace std; long long c, d[200000], l[4], k[200000], x, p[200000], M, m, ctr; priority_queue<pair<long long, long long> > q[4]; long long * createFunTour(long long n, long long Q) { c=1; for(int i=2; i<=n; i++) { if(attractionsBehind(c, i)>=n/2) c=i; } x=1; for(int i=1; i<=n; i++) { if(i!=c) d[i]=hoursRequired(c, i); if(d[i]==1) {l[x]=i;k[i]=x;x++;} } for(int i=1; i<=n; i++) { if(k[i]==0&&i!=c) { if(hoursRequired(i, l[1])<d[i]) k[i]=1; else if(hoursRequired(i, l[2])<d[i]) k[i]=2; else k[i]=3; } } for(int i=1; i<=n; i++) { q[k[i]].push(mp(d[i], i)); } x=0; ctr=1; while(2*max(max(q[1].size(), q[2].size()), q[3].size())<q[1].size()+q[2].size()+q[3].size()) { m=0; for(int i=1; i<=3; i++) { if(i!=x) { if(m<q[i].front().first) { m=q[i].front().first; M=i; } } } x=M; p[ctr]=q[x].front().second; ctr++; q[x].pop(); } for(int i=1; i<=3; i++) { if(q[i].size()==max(max(q[1].size(), q[2].size()), q[3].size())) M=i; } for(int i=1; i<=3; i++) { if(x!=i&&q[i].size()!=max(max(q[1].size(), q[2].size()), q[3].size())&&q[i].front().first==max(max(q[1].front().first, q[2].front().first), q[3].front().first)) { p[ctr]=q[i].front().second; ctr++; q[i].pop(); x=i; } } if(M!=x) { p[ctr]=q[M].front().second; ctr++; q[M].pop(); x=M; } while(2*max(max(q[1].size(), q[2].size()), q[3].size())>0) { m=0; if(x==M) for(int i=1; i<=3; i++) { if(i!=M) { if(m<q[i].front().first) { m=q[i].front().first; x=i; } } } else x=M; p[ctr]=q[x].front().second; ctr++; q[x].pop(); } p[ctr]=c; return p; }

Compilation message (stderr)

fun.cpp: In function 'long long int* createFunTour(long long int, long long int)':
fun.cpp:35:27: error: 'class std::priority_queue<std::pair<long long int, long long int> >' has no member named 'front'
   35 |                 if(m<q[i].front().first) {
      |                           ^~~~~
fun.cpp:36:28: error: 'class std::priority_queue<std::pair<long long int, long long int> >' has no member named 'front'
   36 |                     m=q[i].front().first;
      |                            ^~~~~
fun.cpp:42:21: error: 'class std::priority_queue<std::pair<long long int, long long int> >' has no member named 'front'
   42 |         p[ctr]=q[x].front().second;
      |                     ^~~~~
fun.cpp:50:85: error: 'class std::priority_queue<std::pair<long long int, long long int> >' has no member named 'front'
   50 |         if(x!=i&&q[i].size()!=max(max(q[1].size(), q[2].size()), q[3].size())&&q[i].front().first==max(max(q[1].front().first, q[2].front().first), q[3].front().first)) {
      |                                                                                     ^~~~~
fun.cpp:50:113: error: 'class std::priority_queue<std::pair<long long int, long long int> >' has no member named 'front'
   50 |         if(x!=i&&q[i].size()!=max(max(q[1].size(), q[2].size()), q[3].size())&&q[i].front().first==max(max(q[1].front().first, q[2].front().first), q[3].front().first)) {
      |                                                                                                                 ^~~~~
fun.cpp:50:133: error: 'class std::priority_queue<std::pair<long long int, long long int> >' has no member named 'front'
   50 |         if(x!=i&&q[i].size()!=max(max(q[1].size(), q[2].size()), q[3].size())&&q[i].front().first==max(max(q[1].front().first, q[2].front().first), q[3].front().first)) {
      |                                                                                                                                     ^~~~~
fun.cpp:50:154: error: 'class std::priority_queue<std::pair<long long int, long long int> >' has no member named 'front'
   50 |         if(x!=i&&q[i].size()!=max(max(q[1].size(), q[2].size()), q[3].size())&&q[i].front().first==max(max(q[1].front().first, q[2].front().first), q[3].front().first)) {
      |                                                                                                                                                          ^~~~~
fun.cpp:51:25: error: 'class std::priority_queue<std::pair<long long int, long long int> >' has no member named 'front'
   51 |             p[ctr]=q[i].front().second;
      |                         ^~~~~
fun.cpp:58:21: error: 'class std::priority_queue<std::pair<long long int, long long int> >' has no member named 'front'
   58 |         p[ctr]=q[M].front().second;
      |                     ^~~~~
fun.cpp:68:31: error: 'class std::priority_queue<std::pair<long long int, long long int> >' has no member named 'front'
   68 |                     if(m<q[i].front().first) {
      |                               ^~~~~
fun.cpp:69:32: error: 'class std::priority_queue<std::pair<long long int, long long int> >' has no member named 'front'
   69 |                         m=q[i].front().first;
      |                                ^~~~~
fun.cpp:75:21: error: 'class std::priority_queue<std::pair<long long int, long long int> >' has no member named 'front'
   75 |         p[ctr]=q[x].front().second;
      |                     ^~~~~