Submission #825207

#TimeUsernameProblemLanguageResultExecution timeMemory
825207Marco_EscandonCarnival Tickets (IOI20_tickets)C++14
0 / 100
2539 ms2097152 KiB
#include "tickets.h"
#include <vector>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
long long find_maximum(int k, std::vector<std::vector<int>> x) {
	int n = x.size();
	int m = x[0].size();
	std::vector<std::vector<int>> answer;
	ll me=0;
	for (int i = 0; i < n; i++) {
		std::vector<int> row(m);
		for (int j = 0; j < m; j++) {
			if (j < k) {
				row[j] = x[i][j];
                m+=x[i][j];
			}
		}
		answer.push_back(row);
	}
	m/=n;
	ll bs=10000000000000000;
	for(int i=m-2; i<m+2; i++)
    {
        ll st=0;
        for (int j = 0; j < n; j++) {
			if (j < k) {
                st=abs(x[j][0]-i);
			}
		}
		bs=min(bs,st);
    }
	allocate_tickets(answer);
	return bs;
}

Compilation message (stderr)

tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:10:5: warning: unused variable 'me' [-Wunused-variable]
   10 |  ll me=0;
      |     ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...