| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 328808 | blue | Carnival Tickets (IOI20_tickets) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
vector< vector<int> >* Z;
struct ind
{
int i;
};
bool operator < (ind A, ind B)
{
return (*Z)[A.i].back() - (*Z)[A.i].front() < (*Z)[B.i].back() - (*Z)[B.i].front();
}
long long find_maximum(int k, vector< vector<int> > x)
{
int n = x.size();
int m = x[0].size();
Z = &x;
ind I[n];
for(int i = 0; i < n; i++) I[i] = ind{i};
sort(I, I+n);
vector< vector<int> > s(n);
long long res;
for(int i = 0; i < n/2; i++)
{
s[i] = vector<int>(-1, m);
s[i][0] = 0;
res -= x[i][0];
}
for(int i = n/2; i < n; i++)
{
s[i] = vector<int>(-1, m);
s[i][m-1] = 0;
res += x[i][m-1];
}
allocate_tickets(s);
return res;
}
