답안 #51146

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
51146 2018-06-16T23:30:11 Z spencercompton Skyscraper (JOI16_skyscraper) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// ll dp[14][1001][1<<14];
vector<vector<vector<ll> > > > dp;
int n, l;
int ar[100];
ll mod = 1000000007LL;
ll go(int mask, int rem, int last){
	if(rem<0){
		return 0LL;
	}
	if(mask==0){
		return 1LL;
	}
	if(dp[last][rem][mask]!=-1LL){
		return dp[last][rem][mask];
	}
	ll ret = 0LL;
	for(int i = 0; i<n; i++){
		if((mask&(1<<i))!=0){
			ret += go(mask-(1<<i), rem-abs(ar[i]-ar[last]),i);
		}
	}
	ret %= mod;
	dp[last][rem][mask] = ret;
	return ret;
}
int main(){
	cin >> n >> l;
	for(int i = 0; i<n; i++){
		cin >> ar[i];
	}
	int maxi = (1<<n);
	for(int i = 0; i<n; i++){
		vector<vector<ll> > a;
		for(int j = 0; j<=l; j++){
			vector<ll> b;
			for(int k = 0; k<maxi; k++){
				b.push_back(-1LL);
			}
			a.push_back(b);
		}
		dp.push_back(a);
	}
	ll ret = 0;
	for(int i = 0; i<n; i++){
		ret += go(maxi-1-(1<<i), l, i);
	}
	ret %= mod;
	cout << ret << endl;
}

Compilation message

skyscraper.cpp:5:30: error: expected unqualified-id before '>' token
 vector<vector<vector<ll> > > > dp;
                              ^
skyscraper.cpp: In function 'll go(int, int, int)':
skyscraper.cpp:16:5: error: 'dp' was not declared in this scope
  if(dp[last][rem][mask]!=-1LL){
     ^~
skyscraper.cpp:26:2: error: 'dp' was not declared in this scope
  dp[last][rem][mask] = ret;
  ^~
skyscraper.cpp: In function 'int main()':
skyscraper.cpp:44:3: error: 'dp' was not declared in this scope
   dp.push_back(a);
   ^~