제출 #561149

#제출 시각아이디문제언어결과실행 시간메모리
561149ahmet34카니발 티켓 (IOI20_tickets)C++14
27 / 100
514 ms53040 KiB
#include <bits/stdc++.h> #include "tickets.h" using namespace std; using ll = long long; using pii = pair<int, int>; #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() const int INF = 5e8, N = 1e5+10, M = 998244353, LOG = 16; const ll LINF = 1e18; ll find_maximum(int k, vector<vector<int>> x) { ll tot_sum = 0; priority_queue<pair<int, int>> pq; int n = x.size(), m = x[0].size(); vector<int> lp(n, k-1), rp(n, m-1); for (int i = 0; i < n; i++) { for(int j = 0; j < k; j++) { tot_sum -= x[i][j]; } pq.push({x[i][lp[i]] + x[i][rp[i]], i}); } int to_swap = (n * k) / 2; vector<vector<int>> b(n, vector<int>(m, -1)); while(!pq.empty() and to_swap) { auto [inc, c] = pq.top(); pq.pop(); tot_sum += inc; to_swap--; b[c][rp[c]] = 1; lp[c]--; rp[c]--; if(lp[c] >= 0 and n-1-rp[c] < k) { pq.push({x[c][lp[c]] + x[c][rp[c]], c}); } } assert(to_swap == 0); for(int i = 0; i < n; i++) { int cnt = (i&1 ? k-1 : 0); for (int j = 0; j < m; j++) { if(b[i][j] == 1 or j <= lp[i]) { b[i][j] = (i&1 ? cnt-- : cnt++); } } } allocate_tickets(b); return tot_sum; }

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

tickets.cpp: In function 'll find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:31:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   31 |         auto [inc, c] = pq.top(); pq.pop();
      |              ^
#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...