제출 #259878

#제출 시각아이디문제언어결과실행 시간메모리
259878peuchGlobal Warming (CEOI18_glo)C++17
28 / 100
2090 ms1912 KiB
#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 = n; i > 0; i--){
		for(int j = 1; j <= n; j++)
			dp[j] = INF;
		for(int j = 1; j <= n; j++){
			int k = lower_bound(dp, dp + 1 + n, v[j]) - dp;
			dp[k] = v[j];
			ans = max(ans, k);
		}
		v[i] += x;
	}
	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;
}

컴파일 시 표준 에러 (stderr) 메시지

glo.cpp: In function 'int main()':
glo.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);
  ~~~~~^~~~~~~~~~~~~~~~~
glo.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 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...