Submission #124244

# Submission time Handle Problem Language Result Execution time Memory
124244 2019-07-02T21:51:01 Z tutis Mountains (IOI17_mountains) C++17
Compilation error
0 ms 0 KB
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
bitset<2000>ok[2000];
unordered_map<bitset<2000>, int>M;
int dp(bitset<2000> x)
{
	//auto it = M.find(x);
	//if (it != M.end())
	//	return it->second;
	int i = x._Find_first();
	if (i >= 2000)
		return 0;
	x[i] = false;
	return /*M[x] = */max(1 + dp(x & ok[i]), dp(x));
}
int maximum_deevs(vector<int> y)
{
	M.clear();
	for (int i = 0; i < 2000; i++)
	{
		ok[i].reset();
	}
	bitset<2000>deevs;
	for (ll i = 0; i < (ll)y.size(); i++)
	{
		ll k = i + 1;
		for (ll j = i + 1; j < (ll)y.size(); j++)
		{
			if ((y[j] - y[i]) * (k - i) >= (y[k] - y[i]) * (j - i))
				k = j;
			if (j != k)
			{
				ok[i][j] = true;
			}
			else
				ok[i][j] = false;
		}
		deevs[i] = true;
	}
	return dp(deevs);
}
int main()
{
	cout << maximum_deevs({ 6, 1, 5, 2, 3, 1}) << endl;//3
	cout << maximum_deevs({ 0, 1, 2}) << endl;//1
}/**/

Compilation message

/tmp/ccERsDw7.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccm8NMd2.o:mountains.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status