제출 #699847

#제출 시각아이디문제언어결과실행 시간메모리
699847Iliya_Global Warming (CEOI18_glo)C++14
컴파일 에러
0 ms0 KiB
// IN THE NAME OF GOD
#include<bits/stdc++.h>
//#pragma GCC optimize ("O2,unroll-loops,O3,Ofast,no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#define endl '\n';
#define file_reading freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
using namespace std;
typedef long long ll;
typedef long double dll;
typedef unsigned long long ull;

const ll B = 2e5+7, inf = 1e18; 
int arr[B],arr2[B];
int n,x; 

ll ans_(){
	vector<ll> dp(n+1,inf);
	dp[0] = -inf; 
	dp[1] = arr[1]; 
	int ans = 1; 
	for(int i=2; i<=n; i++){
		int ind = lower_bound(dp.begin(),dp.end(),arr[i])-dp.begin(); 
		dp[ind] = arr[i];
		ans = max(ans,ind); 
	}
	return ans;
}

void solve(){
	cin >> n >> x; 
	for(int i=1; i<=n; i++){cin >> arr[i]; arr2[i] = arr[i];}
	if (x == 0){cout << ans_() << endl; return;}
	if (n <= 50 && x <= 50){
		ll ans = 0; 
		for(int i=1; i<=n; i++){
			for(int j=i; j<=n; j++){
				for(int change = -x; change <= x; change++){
					arr[j]+=change; 	
					ans = max(ans,ans_()); 
				}
			}
			for(int j=i; j<=n; j++){arr[j] = arr2[j];}
		}
		cout << ans << endl;
1	}
}
 
int32_t main(){
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int t; t=1;
	while(t--){solve();}
	return 0;
}

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

glo.cpp: In function 'void solve()':
glo.cpp:45:2: error: expected ';' before '}' token
   45 | 1 }
      |  ^~
      |  ;
glo.cpp:45:1: warning: statement has no effect [-Wunused-value]
   45 | 1 }
      | ^