제출 #1017729

#제출 시각아이디문제언어결과실행 시간메모리
1017729ZeroCool카니발 티켓 (IOI20_tickets)C++14
100 / 100
459 ms76120 KiB
#include "tickets.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;

#define ar array
#define int long long

long long find_maximum(signed k, std::vector<std::vector<signed>> A) {
	
	int n = A.size();
	int m = A[0].size();
	
	vector<vector<signed> > res(n, vector<signed>(m, -1));
	int ans = 0;
	int cnt[n];
	priority_queue<ar<int, 2> > pq;
	for(int i = 0;i < n;i++){
		cnt[i] = k - 1;
		for(int j = 0;j < k;j++)ans -= A[i][j];
		pq.push({A[i][k-1] + A[i][m-1], i});
	}
	
	for(int it = 0;it < n * k / 2;it++){
		int x = pq.top()[0];
		int i = pq.top()[1];
		pq.pop();
		ans += x;
		--cnt[i];
		if(cnt[i] == -1)continue;
		
		pq.push({A[i][cnt[i]] + A[i][m - k + cnt[i]], i});
	}
	
	int r = 0;
	for(int i = 0;i < n;i++){
		for(int j = 0;j <= cnt[i];j++)res[i][j] = (r++) % k;
		int t = r;
		for(int j = m - k + cnt[i] + 1;j < m;j++)res[i][j] = (t++) % k;
	}
	
	allocate_tickets(res);
	return ans;
}

#define int signed

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

tickets.cpp:46: warning: "int" redefined
   46 | #define int signed
      | 
tickets.cpp:7: note: this is the location of the previous definition
    7 | #define int long long
      |
#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...