| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1064915 | ArthuroWich | 카니발 티켓 (IOI20_tickets) | C++17 | 1 ms | 600 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "tickets.h"
#include<bits/stdc++.h>
using namespace std;
long long find_maximum(int k, vector<vector<int>> x) {
int n = x.size(), m = x[0].size();
vector<vector<int>> answer(n, vector<int>(m, -1));
vector<deque<pair<int, int>>> t(n);
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
t[i].push_back({x[i][j], j});
}
sort(t[i].begin(), t[i].end());
}
int ans = 0;
for (int c = 0; c < k; c++) {
vector<int> arr, vis(n, 0);
vector<tuple<int, int, int>> a;
for (int i = 0; i < n; i++) {
a.push_back({t[i].back().first, i, t[i].back().second});
if (t[i].size() > 1) {
a.push_back({t[i].front().first, i, t[i].front().second});
}
}
sort(a.begin(), a.end());
for (int ind = 0; ind < a.size(); ind++) {
auto [v, i, j] = a[ind];
if (arr.size() == n/2) {
break;
}
if (vis[i]) {
continue;
}
vis[i] = 1;
if (t[i].back().second == j) {
t[i].pop_back();
} else {
t[i].pop_front();
}
answer[i][j] = c;
arr.push_back(v);
}
reverse(a.begin(), a.end());
for (int ind = 0; ind < a.size(); ind++) {
auto [v, i, j] = a[ind];
if (vis[i]) {
continue;
}
vis[i] = 1;
if (t[i].back().second == j) {
t[i].pop_back();
} else {
t[i].pop_front();
}
answer[i][j] = c;
arr.push_back(v);
}
sort(arr.begin(), arr.end());
int med = arr[n/2-1];
for (int i = 0; i < n; i++) {
ans += abs(arr[i]-med);
}
}
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... | ||||
