답안 #18155

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
18155 2016-01-25T01:13:44 Z comet 학교 설립 (IZhO13_school) C++
컴파일 오류
0 ms 0 KB
#include <cstdio>
#include <cstring>
#include <cassert>

using namespace std;
typedef long long ll;

int N,M,S;
ll d[101][101][101];
ll a[101],b[101];

ll max(ll x,ll y){
	return x>y?x:y;
}

ll max(ll x,ll y,ll z){
	return max(x,max(y,z));
}

ll f(int p,int x,int y){
	if(p==N){
		if(x==M&&y==S)return 0;
		return -1e9
	}
	ll& ret=d[p][x][y];
	if(~ret)return ret;
	ret=f(p+1,x,y);
	if(x<M)ret=max(ret,f(p+1,x+1,y)+a[x]);
	if(y<S)ret=max(ret,f(p+1,x,y+1)+b[y]);
	return ret;
}

int main(){

	scanf("%d%d%d",&N,&M,&S);

	assert(N<=100);
	assert(M<=100);
	assert(S<=100);

	for(int i=0;i<N;i++){
		scanf("%lld%lld\n",&a[i],&b[i]);
	}

	memset(d,-1,sizeof(d));

	printf("%lld\n",f(0,0,0));

	return 0;
}

Compilation message

school.cpp: In function ‘ll f(int, int, int)’:
school.cpp:24:2: error: expected ‘;’ before ‘}’ token
  }
  ^
school.cpp: In function ‘int main()’:
school.cpp:35:26: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d%d",&N,&M,&S);
                          ^
school.cpp:42:34: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld%lld\n",&a[i],&b[i]);
                                  ^