답안 #124245

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
124245 2019-07-02T21:51:13 Z tutis Mountains (IOI17_mountains) C++17
20 / 100
1000 ms 892 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

mountains.cpp:49:2: warning: "/*" within comment [-Wcomment]
 }/**/
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 760 KB Output is correct
2 Correct 2 ms 760 KB Output is correct
3 Correct 2 ms 760 KB Output is correct
4 Correct 2 ms 760 KB Output is correct
5 Correct 2 ms 760 KB Output is correct
6 Correct 2 ms 760 KB Output is correct
7 Correct 2 ms 760 KB Output is correct
8 Correct 2 ms 760 KB Output is correct
9 Correct 3 ms 760 KB Output is correct
10 Correct 3 ms 760 KB Output is correct
11 Correct 3 ms 760 KB Output is correct
12 Correct 2 ms 760 KB Output is correct
13 Correct 3 ms 760 KB Output is correct
14 Correct 3 ms 760 KB Output is correct
15 Correct 3 ms 760 KB Output is correct
16 Correct 2 ms 760 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 760 KB Output is correct
2 Correct 2 ms 760 KB Output is correct
3 Correct 2 ms 760 KB Output is correct
4 Correct 2 ms 760 KB Output is correct
5 Correct 2 ms 760 KB Output is correct
6 Correct 2 ms 760 KB Output is correct
7 Correct 2 ms 760 KB Output is correct
8 Correct 2 ms 760 KB Output is correct
9 Correct 3 ms 760 KB Output is correct
10 Correct 3 ms 760 KB Output is correct
11 Correct 3 ms 760 KB Output is correct
12 Correct 2 ms 760 KB Output is correct
13 Correct 3 ms 760 KB Output is correct
14 Correct 3 ms 760 KB Output is correct
15 Correct 3 ms 760 KB Output is correct
16 Correct 2 ms 760 KB Output is correct
17 Correct 809 ms 892 KB Output is correct
18 Correct 704 ms 892 KB Output is correct
19 Correct 333 ms 764 KB Output is correct
20 Correct 987 ms 888 KB Output is correct
21 Correct 5 ms 888 KB Output is correct
22 Correct 5 ms 888 KB Output is correct
23 Correct 5 ms 888 KB Output is correct
24 Correct 4 ms 888 KB Output is correct
25 Correct 5 ms 888 KB Output is correct
26 Correct 5 ms 888 KB Output is correct
27 Correct 997 ms 888 KB Output is correct
28 Correct 18 ms 760 KB Output is correct
29 Correct 8 ms 764 KB Output is correct
30 Correct 10 ms 888 KB Output is correct
31 Correct 4 ms 888 KB Output is correct
32 Correct 6 ms 888 KB Output is correct
33 Execution timed out 1076 ms 888 KB Time limit exceeded
34 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 760 KB Output is correct
2 Correct 2 ms 760 KB Output is correct
3 Correct 2 ms 760 KB Output is correct
4 Correct 2 ms 760 KB Output is correct
5 Correct 2 ms 760 KB Output is correct
6 Correct 2 ms 760 KB Output is correct
7 Correct 2 ms 760 KB Output is correct
8 Correct 2 ms 760 KB Output is correct
9 Correct 3 ms 760 KB Output is correct
10 Correct 3 ms 760 KB Output is correct
11 Correct 3 ms 760 KB Output is correct
12 Correct 2 ms 760 KB Output is correct
13 Correct 3 ms 760 KB Output is correct
14 Correct 3 ms 760 KB Output is correct
15 Correct 3 ms 760 KB Output is correct
16 Correct 2 ms 760 KB Output is correct
17 Correct 809 ms 892 KB Output is correct
18 Correct 704 ms 892 KB Output is correct
19 Correct 333 ms 764 KB Output is correct
20 Correct 987 ms 888 KB Output is correct
21 Correct 5 ms 888 KB Output is correct
22 Correct 5 ms 888 KB Output is correct
23 Correct 5 ms 888 KB Output is correct
24 Correct 4 ms 888 KB Output is correct
25 Correct 5 ms 888 KB Output is correct
26 Correct 5 ms 888 KB Output is correct
27 Correct 997 ms 888 KB Output is correct
28 Correct 18 ms 760 KB Output is correct
29 Correct 8 ms 764 KB Output is correct
30 Correct 10 ms 888 KB Output is correct
31 Correct 4 ms 888 KB Output is correct
32 Correct 6 ms 888 KB Output is correct
33 Execution timed out 1076 ms 888 KB Time limit exceeded
34 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 760 KB Output is correct
2 Correct 2 ms 760 KB Output is correct
3 Correct 2 ms 760 KB Output is correct
4 Correct 2 ms 760 KB Output is correct
5 Correct 2 ms 760 KB Output is correct
6 Correct 2 ms 760 KB Output is correct
7 Correct 2 ms 760 KB Output is correct
8 Correct 2 ms 760 KB Output is correct
9 Correct 3 ms 760 KB Output is correct
10 Correct 3 ms 760 KB Output is correct
11 Correct 3 ms 760 KB Output is correct
12 Correct 2 ms 760 KB Output is correct
13 Correct 3 ms 760 KB Output is correct
14 Correct 3 ms 760 KB Output is correct
15 Correct 3 ms 760 KB Output is correct
16 Correct 2 ms 760 KB Output is correct
17 Correct 809 ms 892 KB Output is correct
18 Correct 704 ms 892 KB Output is correct
19 Correct 333 ms 764 KB Output is correct
20 Correct 987 ms 888 KB Output is correct
21 Correct 5 ms 888 KB Output is correct
22 Correct 5 ms 888 KB Output is correct
23 Correct 5 ms 888 KB Output is correct
24 Correct 4 ms 888 KB Output is correct
25 Correct 5 ms 888 KB Output is correct
26 Correct 5 ms 888 KB Output is correct
27 Correct 997 ms 888 KB Output is correct
28 Correct 18 ms 760 KB Output is correct
29 Correct 8 ms 764 KB Output is correct
30 Correct 10 ms 888 KB Output is correct
31 Correct 4 ms 888 KB Output is correct
32 Correct 6 ms 888 KB Output is correct
33 Execution timed out 1076 ms 888 KB Time limit exceeded
34 Halted 0 ms 0 KB -