Submission #259876

# Submission time Handle Problem Language Result Execution time Memory
259876 2020-08-08T18:18:40 Z peuch Lottery (CEOI18_lot) C++17
0 / 100
3000 ms 1048 KB
#include<bits/stdc++.h>
using namespace std;

const int MAXN = 2e5 + 10;
const int INF = 2e9 + 7;

int n, x;
int v[MAXN];
int dp[MAXN];
int ans;

void bt(int cur, int sum);

int main(){
	scanf("%d %d", &n, &x);
	for(int i = 1; i <= n; i++)
		scanf("%d", &v[i]);
	for(int i = 0; i < n; i++)
		for(int j = -x; j <= x; j++)
			bt(i, j);
	printf("%d\n", ans);
}

void bt(int cur, int sum){
	for(int i = 1; i <= n; i++)
		dp[i] = INF;
	for(int i = 1; i <= n; i++){
		int k = lower_bound(dp, dp + 1 + n, v[i]) - dp;
		dp[k] = v[i];
		ans = max(ans, k);
	}
	if(cur == n) return;
	v[cur + 1] += sum;
	bt(cur + 1, sum);
	v[cur + 1] -= sum;
}

Compilation message

lot.cpp: In function 'int main()':
lot.cpp:15:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &n, &x);
  ~~~~~^~~~~~~~~~~~~~~~~
lot.cpp:17:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &v[i]);
   ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3060 ms 1048 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3060 ms 1048 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -