Submission #603745

#TimeUsernameProblemLanguageResultExecution timeMemory
603745CyberCowCarnival Tickets (IOI20_tickets)C++17
Compilation error
0 ms0 KiB
#include "tickets.h"
#include <vector>
using namespace std;
using ll = long long;

ll qaq(vector<int> qaqa)
{
	ll polni = 0;
	for (int i = 0; i < qaqa.size(); i++)
	{
		ll chsh = 0;
		for (int j = 0; j < qaqa.size(); j++)
		{
			chsh += abs(qaqa[i] - qaqa[j]);
		}
		polni = max(polni, chsh);
	}
	return polni;
}

long long find_maximum(int k, vector<vector<int>> x) {
	int n = x.size();
	int m = x[0].size();
	vector<vector<int>> answer;
	for (int i = 0; i < n; i++) {
		vector<int> row(m);
		answer.push_back(row);
	}
	allocate_tickets(answer);
	return qaq(x[0]);
}

Compilation message (stderr)

tickets.cpp: In function 'll qaq(std::vector<int>)':
tickets.cpp:9:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |  for (int i = 0; i < qaqa.size(); i++)
      |                  ~~^~~~~~~~~~~~~
tickets.cpp:12:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |   for (int j = 0; j < qaqa.size(); j++)
      |                   ~~^~~~~~~~~~~~~
tickets.cpp:14:12: error: 'abs' was not declared in this scope
   14 |    chsh += abs(qaqa[i] - qaqa[j]);
      |            ^~~