답안 #1086342

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1086342 2024-09-10T09:35:11 Z Raiden Skyscraper (JOI16_skyscraper) C++14
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>using namespace std;const int MOD = 1e9 + 7;const int MAX = 105;int dp[3][MAX][MAX][MAX * 10], n;int arr[MAX];int f(int alive_ends, int i,int components, int sm){	if(alive_ends < 0) return 0;	if(sm < 0) return 0;	if(i == n) return alive_ends == 0 && components == 1;	int &ret = dp[alive_ends][i][components][sm];	if(~ret) return ret;	ret = 0;	sm -= (2 * components - 2 + alive_ends) * (arr[i] - arr[i - 1]);	ret = (ret + 1LL * (2 * components - 2 + alive_ends) * f(alive_ends, i + 1, components, sm)) % MOD;	if(components) ret = (ret + 1LL * alive_ends * f(alive_ends - 1, i + 1, components, sm)) % MOD;	ret = (ret + 1LL * (components - 1 + alive_ends) * f(alive_ends, i + 1, components + 1, sm)) % MOD;	if(alive_ends) ret = (ret + 1LL * alive_ends * f(alive_ends - 1, i + 1, components + 1, sm)) % MOD;	if(components) ret = (ret + 1LL * (components - 1) * f(alive_ends, i + 1, components - 1, sm)) % MOD;	return ret;}void solve(){	int k;	cin >> n >> k;	memset(dp, -1, sizeof dp);	for(int i = 0; i < n; i++) cin >> arr[i];	sort(arr, arr + n);	if(n == 1){		cout << 1 << '\n';		return ;	}	cout << (f(2, 0, 0, k)) % MOD << '\n'; } int32_t main(){	ios_base::sync_with_stdio(0), cin.tie(0);	int t = 1;	// cin >> t;	while(t--) solve();}

Compilation message

skyscraper.cpp:1:30: warning: extra tokens at end of #include directive
    1 | #include<bits/stdc++.h>using namespace std;const int MOD = 1e9 + 7;const int MAX = 105;int dp[3][MAX][MAX][MAX * 10], n;int arr[MAX];int f(int alive_ends, int i,int components, int sm){ if(alive_ends < 0) return 0; if(sm < 0) return 0; if(i == n) return alive_ends == 0 && components == 1; int &ret = dp[alive_ends][i][components][sm]; if(~ret) return ret; ret = 0; sm -= (2 * components - 2 + alive_ends) * (arr[i] - arr[i - 1]); ret = (ret + 1LL * (2 * components - 2 + alive_ends) * f(alive_ends, i + 1, components, sm)) % MOD; if(components) ret = (ret + 1LL * alive_ends * f(alive_ends - 1, i + 1, components, sm)) % MOD; ret = (ret + 1LL * (components - 1 + alive_ends) * f(alive_ends, i + 1, components + 1, sm)) % MOD; if(alive_ends) ret = (ret + 1LL * alive_ends * f(alive_ends - 1, i + 1, components + 1, sm)) % MOD; if(components) ret = (ret + 1LL * (components - 1) * f(alive_ends, i + 1, components - 1, sm)) % MOD; return ret;}void solve(){ int k; cin >> n >> k; memset(dp, -1, sizeof dp); for(int i = 0; i < n; i++) cin >> arr[i]; sort(arr, arr + n); if(n == 1){  cout << 1 << '\n';  return ; } cout << (f(2, 0, 0, k)) % MOD << '\n'; } int32_t main(){ ios_base::sync_with_stdio(0), cin.tie(0); int t = 1; // cin >> t; while(t--) solve();}
      |                              ^~~~~~~~~
skyscraper.cpp:1:9: fatal error: bits/stdc++.h>usin: No such file or directory
    1 | #include<bits/stdc++.h>using namespace std;const int MOD = 1e9 + 7;const int MAX = 105;int dp[3][MAX][MAX][MAX * 10], n;int arr[MAX];int f(int alive_ends, int i,int components, int sm){ if(alive_ends < 0) return 0; if(sm < 0) return 0; if(i == n) return alive_ends == 0 && components == 1; int &ret = dp[alive_ends][i][components][sm]; if(~ret) return ret; ret = 0; sm -= (2 * components - 2 + alive_ends) * (arr[i] - arr[i - 1]); ret = (ret + 1LL * (2 * components - 2 + alive_ends) * f(alive_ends, i + 1, components, sm)) % MOD; if(components) ret = (ret + 1LL * alive_ends * f(alive_ends - 1, i + 1, components, sm)) % MOD; ret = (ret + 1LL * (components - 1 + alive_ends) * f(alive_ends, i + 1, components + 1, sm)) % MOD; if(alive_ends) ret = (ret + 1LL * alive_ends * f(alive_ends - 1, i + 1, components + 1, sm)) % MOD; if(components) ret = (ret + 1LL * (components - 1) * f(alive_ends, i + 1, components - 1, sm)) % MOD; return ret;}void solve(){ int k; cin >> n >> k; memset(dp, -1, sizeof dp); for(int i = 0; i < n; i++) cin >> arr[i]; sort(arr, arr + n); if(n == 1){  cout << 1 << '\n';  return ; } cout << (f(2, 0, 0, k)) % MOD << '\n'; } int32_t main(){ ios_base::sync_with_stdio(0), cin.tie(0); int t = 1; // cin >> t; while(t--) solve();}
      |         ^~~~~~~~~~~~~~~~~~~~
compilation terminated.