| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 421336 | Apiram | 카니발 티켓 (IOI20_tickets) | C++14 | 3082 ms | 460 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "tickets.h"
#include <vector>
#include<bits/stdc++.h>
using namespace std;
struct point{
int mi,mix,miy;
int ma,maxx,may;
};
int64_t maxxy=0;
vector<pair<int,int>>opti;
void optimal(vector<point>arr,int j,vector<pair<int,pair<int,int>>>opt){
if (j>=arr.size()){
int64_t sum =INT_MAX;
for (int i =0;i<arr.size();++i){
int64_t counts=0;
for (int k =0;k<arr.size();++k){
counts+=abs(opt[k].second.second - opt[i].second.second);
}
sum=min(counts,sum);
}
if (sum>maxxy){
maxxy=sum;
opti.clear();
for (int i =0;i<arr.size();++i){
opti.push_back({opt[i].first,opt[i].second.first});
}
}
return;
}
opt.push_back({arr[j].mix,{arr[j].miy,arr[j].mi}});
optimal (arr,j+1,opt);
opt.pop_back();
opt.push_back({arr[j].maxx,{arr[j].may,arr[j].ma}});
optimal(arr,j+1,opt);
opt.pop_back();
}
long long find_maximum(int k, std::vector<std::vector<int>> x) {
int n = x.size();
long long score=0;
int m = x[0].size();
vector<vector<int>>answer(n,vector<int>(m,-1));
for (int it = 0;it<k;++it){
vector<point>arr;
for (int i =0;i<n;++i){
point a;
for (int j =0;j<m;++j){
if (answer[i][j]==-1){
a.mi=x[i][j];
a.mix=i;
a.miy=j;
break;
}
}
for (int j =m-1;j>=0;--j){
if (answer[i][j]==-1){
a.ma=x[i][j];
a.maxx=i;
a.may=j;
break;
}
}
arr.push_back(a);
}
vector<pair<int,pair<int,int>>>opt;
maxxy=0;
opti.clear();
optimal(arr,0,opt);
score+=maxxy;
for (int i =0;i<n;++i){
answer[opti[i].first][opti[i].second]=it;
}
}
allocate_tickets(answer);
return score;
}
컴파일 시 표준 에러 (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... | ||||
