# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
639146 | slime | 카니발 티켓 (IOI20_tickets) | C++14 | 1052 ms | 114520 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "tickets.h"
#include "bits/stdc++.h"
using namespace std;
long long find_maximum(int k, std::vector<std::vector<int>> x) {
int n = x.size();
int m = x[0].size();
std::vector<std::vector<int>> answer;
for (int i = 0; i < n; i++) {
std::vector<int> row(m);
for (int j = 0; j < m; j++) {
row[j] = -1;
}
answer.push_back(row);
}
priority_queue<pair<long long, pair<int, int> > > pq;
for(int i=0; i<n; i++) {
for(int j=0; j<m; j++) {
pq.push({x[i][j], {i, j}});
}
}
int round[m];
for(int i=0; i<m; i++) round[i] = 0;
long long ans = 0;
for(int i=0; i<n*m/2; i++) {
int ii = pq.top().second.first;
int jj = pq.top().second.second;
ans += pq.top().first;
pq.pop();
answer[ii][jj] = 0;
}
for(int i=0; i<n*m/2; i++) {
ans -= pq.top().first;
pq.pop();
}
int nxt = 0;
for(int i=0; i<n; i++) {
for(int j=0; j<m; j++) {
if(answer[i][j] == 0) {
answer[i][j] = nxt;
nxt = (nxt + 1) % m;
}
}
}
for(int i=0; i<n; i++) {
bool used[m];
for(int j=0; j<m; j++) {
used[j] = 0;
}
for(int j=0; j<m; j++) {
if(answer[i][j] >= 0) used[answer[i][j]] = 1;
}
int rb = 0;
for(int j=0; j<m; j++) {
if(answer[i][j] == -1) {
while(used[rb]) rb++;
answer[i][j] = rb;
used[rb] = 1;
}
}
}
allocate_tickets(answer);
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |