제출 #307920

#제출 시각아이디문제언어결과실행 시간메모리
307920jwvg0425카니발 티켓 (IOI20_tickets)C++17
0 / 100
1 ms384 KiB
#include "tickets.h" #include <vector> #include <algorithm> #define all(x) x.begin(), x.end() using namespace std; using i64 = long long int; struct Ticket { int color; int idx; int value; }; i64 find_maximum(int k, vector<vector<int>> x) { int n = x.size(); int m = x[0].size(); vector<Ticket> tickets; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { Ticket t; t.color = i; t.idx = j; t.value = x[i][j]; } } sort(all(tickets), [](const Ticket& l, const Ticket& r) { return l.value < r.value; }); i64 ret = 0; vector<vector<int>> ans(n, vector<int>(m, -1)); vector<int> nxt(n + 1); int l = 0, r = n * m - 1; while (l < r) { ret += tickets[r].value - tickets[l].value; ans[tickets[l].color][tickets[l].value] = nxt[tickets[l].color]; nxt[tickets[l].color]++; ans[tickets[r].color][tickets[r].value] = nxt[tickets[r].color]; nxt[tickets[r].color]++; } allocate_tickets(ans); return ret; }

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

tickets.cpp: In function 'i64 find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:27:11: warning: variable 't' set but not used [-Wunused-but-set-variable]
   27 |    Ticket t;
      |           ^
#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...