제출 #777359

#제출 시각아이디문제언어결과실행 시간메모리
777359_martynas카니발 티켓 (IOI20_tickets)C++14
컴파일 에러
0 ms0 KiB
#include "tickets.h" #include <vector> #include <cmath> using namespace std; #define PB push_back using ll = long long; long long find_maximum(int k, vector<vector<int>> x) { /* sample interaction int n = x.size(); int m = x[0].size(); vector<vector<int>> answer; for (int i = 0; i < n; i++) { vector<int> row(m); for (int j = 0; j < m; j++) { if (j < k) { row[j] = j; } else { row[j] = -1; } } answer.push_back(row); } allocate_tickets(answer); return 1; */ int n = x.size(); int m = x[0].size(); vector<vector<int>> answer(n, vector<int>(m, -1)); if(m == 1) { // subtask 1 (only a single way to pick everything) vector<int> A; for(int i = 0; i < n; i++) { A.PB(x[i][0]); answer[i][0] = 0; } sort(A.begin(), A.end()); ll sum = 0; for(int a : A) { sum += abs(a-A[n/2]); } allocate_tickets(answer); return sum; } else if(k == 1) { // subtask 2 } allocate_tickets(answer); return -1; }

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

tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:39:9: error: 'sort' was not declared in this scope; did you mean 'qsort'?
   39 |         sort(A.begin(), A.end());
      |         ^~~~
      |         qsort