| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 580032 | slime | 카니발 티켓 (IOI20_tickets) | C++14 | 1 ms | 724 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "bits/stdc++.h"
#include "tickets.h"
using namespace std;
long long find_maximum(int k, std::vector<std::vector<int>> d);
void allocate_tickets( std::vector<std::vector<int>> _x);
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);
}
vector<pair<int, int> > v;
for(int i=0; i<n; i++) {
for(int j=0; j<m; j++) {
v.push_back({x[i][j], i});
}
}
sort(v.begin(), v.end());
int cnt[n];
for(int i=0; i<n; i++) cnt[i] = 0;
int distinct = 0;
long long s = 0;
for(int i=0; i<v.size(); i++) {
cnt[v[i].second]++;
if(cnt[v[i].second] == 1) distinct++;
if(distinct == n/2) {
int b = v[i].first;
int sad[n];
for(int j = v.size()-1; j >= 0; j--) {
if(cnt[v[j].second] == 0) {
cnt[v[j].second] = -1;
s += v[j].first - b;
sad[v[j].second] = v[j].first;
}
}
for(int j=i; j>=0; j--) {
if(cnt[v[j].second] > 0) {
cnt[v[j].second] = -1;
s += b - v[j].first;
sad[v[j].second] = v[j].first;
}
}
for(int j=0; j<n; j++) {
for(int l=0; l<m; l++) {
if(x[j][l] == sad[j]) {
answer[j][l] = 0; break;
}
}
}
break;
}
}
allocate_tickets(answer);
return s;
}
//13210230
컴파일 시 표준 에러 (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... | ||||
