제출 #705842

#제출 시각아이디문제언어결과실행 시간메모리
705842finn__카니발 티켓 (IOI20_tickets)C++17
100 / 100
765 ms60520 KiB
#include "tickets.h" #include <bits/stdc++.h> using namespace std; long long find_maximum(int k, vector<vector<int>> x) { long long value = 0; for (size_t i = 0; i < x.size(); i++) for (size_t j = 0; j < k; j++) value -= x[i][j]; vector<size_t> y(x.size(), k); priority_queue<pair<int64_t, size_t>> q; for (size_t i = 0; i < x.size(); i++) q.emplace(x[i][k - 1] + x[i].back(), i); for (size_t z = 0; z < x.size() * k / 2; z++) { auto const [d, i] = q.top(); q.pop(); value += d; y[i]--; if (y[i]) q.emplace(x[i][y[i] - 1] + x[i][x[i].size() - (k - y[i] + 1)], i); } vector<vector<int>> a(x.size(), vector<int>(x[0].size(), -1)); for (size_t j = 0; j < k; j++) { vector<pair<size_t, size_t>> colors; for (size_t i = 0; i < x.size(); i++) colors.emplace_back(y[i], i); sort(colors.begin(), colors.end()); for (size_t i = 0; i < x.size() / 2; i++) a[colors[i].second][x[i].size() - ((k - j) - colors[i].first)] = j; for (size_t i = x.size() / 2; i < x.size(); i++) a[colors[i].second][--y[colors[i].second]] = j; } allocate_tickets(a); return value; }

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

tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:9:30: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
    9 |         for (size_t j = 0; j < k; j++)
      |                            ~~^~~
tickets.cpp:29:26: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   29 |     for (size_t j = 0; j < k; j++)
      |                        ~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...