Submission #17903

# Submission time Handle Problem Language Result Execution time Memory
17903 2016-01-13T07:15:16 Z Erzhann Divide and conquer (IZhO14_divide) C++
Compilation error
0 ms 0 KB
/*
  /\     /\
  | ).|.( |
  |  >-<  |
  =========
It's AdilkhanKo miaaaaaau      
*/
#include<bits/stdc++.h>

#define ll long long
#define pb push_back
#define endl "\n"
#define foreach(it, S) for(__typeof (S.begin()) it = S.begin(); it != S.end(); it++)
#define mp make_pair
#define f first
#define s second 
#define name ""
#define _ ios_base::sync_with_stdio(false);cin.tie(0);

using namespace std;
                                            
const int MaxN = int (2e5) + 256;
const int INF = int(1e9);  
const int mod = (int)(1e9) + 7;
long long n, a[MaxN], m, t, x[MaxN], g[MaxN], d[MaxN], D[MaxN];
bool used[MaxN];

int main () { _
/*	#ifdef ONLINE_JUDGE
		freopen (name".in","r",stdin);
		freopen (name".out","w",stdout);
	#else
		freopen (".in","r",stdin);
		freopen (".out","w",stdout);
	#endif*/
	cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> x[i] >> g[i] >> d[i];
		D[i] = D[i - 1] + d[i];
	}
	int l = 1, r = 1;
	ll ans = 0, cnt = 0;
	while(r <= n){
		if((D[r] - D[l - 1] >= x[r] - x[l])){
			if(!used[r]){
				cnt += g[r];
				used[r] = 1;
			}
			ans = max(cnt, ans); 
			r++;
		}else{
			if(!sed[l]){
				used[l] = 0;
				cnt -= g[l];
			}
			ans - max(ans, cnt);
			l++;
		}
		cnt = max(cnt, 0ll);
		if(l >= r)
			r = l;
	}
	cout << ans;
return 0;
}                   									

Compilation message

divide.cpp: In function ‘int main()’:
divide.cpp:52:8: error: ‘sed’ was not declared in this scope
    if(!sed[l]){
        ^
divide.cpp:56:8: warning: value computed is not used [-Wunused-value]
    ans - max(ans, cnt);
        ^