# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
829995 | Baytoro | Carnival Tickets (IOI20_tickets) | C++17 | 408 ms | 73216 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "tickets.h"
//#include "grader.cpp"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fr first
#define sc second
//#define int long long
long long find_maximum(int k, vector<vector<int>> x) {
int n=x.size(),m=x[0].size();
if(k==1){
vector<vector<int>> ans(n,vector<int>(m,-1));
vector<pair<int,int>> v(n);
vector<int> a;
for(int i=0;i<n;i++){
v[i]={x[i][0]+x[i][m-1],i};
}
sort(v.begin(),v.end());
for(int i=0;i<n/2;i++){
ans[v[i].sc][0]=0;
a.pb(x[v[i].sc][0]);
}
for(int i=n/2;i<n;i++){
ans[v[i].sc][m-1]=0;
a.pb(x[v[i].sc][m-1]);
}
allocate_tickets(ans);
sort(a.begin(),a.end());
long long s=(a[n/2]),res=0;
for(int i=0;i<n;i++) res+=abs(s-a[i]);
return res;
}
}
Compilation message (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... |