# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
399974 | faresbasbs | Carnival Tickets (IOI20_tickets) | C++14 | 1 ms | 204 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 <bits/stdc++.h>
#include "tickets.h"
using namespace std;
int n,m;
long long find_maximum(int k, vector<vector<int>> x){
n = x.size() , m = x[0].size();
vector<pair<int,pair<int,int>>> v;
for(int i = 0 ; i < n ; i += 1){
for(int j = 0 ; j < m ; j += 1){
v.push_back({x[i][j],{i,j}});
}
}
sort(v.begin(),v.end());
vector<vector<int>> ans(n,vector<int>(m,-1));
long long ret = 0;
for(int i = 0 ; i < v.size()/2 ; i += 1){
ret -= v[i].first;
ans[v[i].second.first][v[i].second.second] = 0;
}
for(int i = v.size()/2 ; i < v.size() ; i += 1){
ret += v[i].first;
ans[v[i].second.first][v[i].second.second] = 1;
}
for(int i = 0 ; i < k ; i += 1){
for(int j = 0 ; j < n ; j += 1){
if(j%2 == 0){
ans[j][i] = i;
}else{
ans[j][m-i-1] = i;
}
}
}
// allocate_tickets(ans);
return ret;
}
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... |