답안 #743772

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
743772 2023-05-18T00:45:13 Z LCJLY Semiexpress (JOI17_semiexpress) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h> 
using namespace std;

#define int long long 
typedef pair<int,int>pii;

int32_t main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,m,k,a,b,c,t;
	cin >> n >> m >> k;
	cin >> a >> b >> c;
	cin >> t;

	int arr[n+5];
	for(int x=1;x<=n;x++){
		cin >> arr[x];
	}

	int counter=0;
	if((n-1)*b<=t) counter++;

	priority_queue<int>pq;
	
	for(int x=1;x<n-1;x++){
		int timer=b*(arr[x]-1);
		if(timer>t) continue;
		int hold=(t-timer)/a;
		int target=min(arr[x+1]-1,hold+timer);
		counter+=(target-arr[x]);

		for(int y=0;y<k&&target<arr[x+1]-1;y++){
			int hold2=timer+(range-arr[x]+1)*c;
			if(hold2>t) break;
			int hold3=(t-hold2)/a;
			int target2=min(arr[x+1]-1,target+hold3+1);
			pq.push(target2-target);
			target=target2;
		}
	}

	for(int x=m;x<k;x++){
		if(pq.empty()) break;
		counter+=pq.top();
		pq.pop();
	}

	cout << counter-1;
}

Compilation message

semiexpress.cpp: In function 'int32_t main()':
semiexpress.cpp:33:21: error: 'range' was not declared in this scope
   33 |    int hold2=timer+(range-arr[x]+1)*c;
      |                     ^~~~~