제출 #955034

#제출 시각아이디문제언어결과실행 시간메모리
955034Trisanu_Das카니발 티켓 (IOI20_tickets)C++17
컴파일 에러
0 ms0 KiB
#include "tickets.h" #include <bits/stdc++.h> using namespace std; long long find_maximum(int k, vector<vector<int> > x) { int n = x.size(), m = x[0].size(); vector<vector<int> > ans(n, vector<int>(m, -1)); if(k == 1){ long long sum = 0; priority_queue<pair<long long, long long>, vector<pair<long long, long long> >, greater<pair<long long, long long> > pq; for(int i = 0; i < n; i++){ sum += x[i][m - 1]; pq.push({x[i][0] + x[i][m - 1], i}); } for(int i = 0; i < n; i++){ if(i < n / 2){ sum -= pq.top().first; ans[pq.top().second][0] = 0; }else ans[pq.top().second][m - 1] = 0; } allocate_tickets(ans); return sum; } }

컴파일 시 표준 에러 (stderr) 메시지

tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:10:123: error: template argument 3 is invalid
   10 |     priority_queue<pair<long long, long long>,  vector<pair<long long, long long> >, greater<pair<long long, long long> > pq;
      |                                                                                                                           ^~
tickets.cpp:13:7: error: 'pq' was not declared in this scope
   13 |       pq.push({x[i][0] + x[i][m - 1], i});
      |       ^~
tickets.cpp:17:16: error: 'pq' was not declared in this scope
   17 |         sum -= pq.top().first;
      |                ^~
tickets.cpp:19:17: error: 'pq' was not declared in this scope
   19 |       }else ans[pq.top().second][m - 1] = 0;
      |                 ^~
tickets.cpp:7:49: warning: control reaches end of non-void function [-Wreturn-type]
    7 |   vector<vector<int> > ans(n, vector<int>(m, -1));
      |                                                 ^