Submission #603707

#TimeUsernameProblemLanguageResultExecution timeMemory
603707gagik_2007Carnival Tickets (IOI20_tickets)C++17
11 / 100
3 ms724 KiB
#include "tickets.h"
#include <iostream>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <string>
using namespace std;

#define ff first
#define ss second

typedef long long ll;
typedef long double ld;

const ll INF = 1e18;
ll n, k, m;

ll find_answer(vector<ll>a) {
	ll ans = INF;
	for (int i = 0; i < a.size(); i++) {
		ll cur = 0;
		for (int j = 0; j < a.size(); j++) {
			cur += abs(a[i] - a[j]);
		}
		ans = min(ans, cur);
	}
	return ans;
}

ll find_maximum(int k, vector<vector<int>> x) {
	n = x.size();
	m = x[0].size();
	if (m == 1) {
		vector<vector<int>>ans;
		vector<ll>v;
		ans.resize(n);
		for (int i = 0; i < n; i++) {
			ans[i].resize(1, 0);
			v.push_back(x[i][0]);
		}
		allocate_tickets(ans);
		return find_answer(v);
	}
	if (k == 1) {

	}
}

/*
3 1 1 1 2 3
*/

Compilation message (stderr)

tickets.cpp: In function 'll find_answer(std::vector<long long int>)':
tickets.cpp:21:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |  for (int i = 0; i < a.size(); i++) {
      |                  ~~^~~~~~~~~~
tickets.cpp:23:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |   for (int j = 0; j < a.size(); j++) {
      |                   ~~^~~~~~~~~~
tickets.cpp: In function 'll find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:48:1: warning: control reaches end of non-void function [-Wreturn-type]
   48 | }
      | ^
#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...