제출 #302619

#제출 시각아이디문제언어결과실행 시간메모리
302619Namnamseo카니발 티켓 (IOI20_tickets)C++17
27 / 100
701 ms42744 KiB
#include "tickets.h"
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
using pp=pair<int, int>;
using ll=long long;

int n, m, k;
int prog[1510];

priority_queue<pp> pq;
ll ans;

int pg(auto &x, int i, int j) {
	return -x[i][j]-x[i][m-k+j];
}

int nc[1510];
ll find_maximum(int k_, vector<vector<int>> x) {
	n = x.size(); m = x[0].size(); k = k_;

	for(int i=0; i<n; ++i) for(int j=m-k; j<m; ++j) ans += x[i][j];

	for(int i=0; i<n; ++i) pq.emplace(pg(x, i, 0), i);

	for(int cnt=n*k/2; cnt--;) {
		auto [tv, ti] = pq.top(); pq.pop();
		ans += tv;
		if (++prog[ti] != k) {
			pq.emplace(pg(x, ti, prog[ti]), ti);
		}
	}

	for(int i=0; i<n; ++i) {
		fill(x[i].begin(), x[i].end(), -1);
		int t = prog[i];
		int ai = 0, bi = m-1;
		for(int j=0; j<k; ++j) {
			if (ai < t && nc[j] != n/2) {
				x[i][ai++] = j;
				++nc[j];
			} else {
				x[i][bi--] = j;
			}
		}
	}

	allocate_tickets(x);

	return ans;
}

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

tickets.cpp:15:8: warning: use of 'auto' in parameter declaration only available with '-fconcepts'
   15 | int pg(auto &x, int i, int 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...