Submission #133453

#TimeUsernameProblemLanguageResultExecution timeMemory
133453win11905Skyscraper (JOI16_skyscraper)C++11
15 / 100
127 ms130552 KiB
#include <bits/stdc++.h> using namespace std; const int M = 1e9+7; const int N = 105; const int L = 1005; int n, m; int arr[N]; int dp[N][N][L][3]; int mic(int i, int j, int k, int l) { if(i != 0 && (j <= 0 || l > 2)) return 0; int& z = dp[i][j][k][l]; if(z != -1) return z; if(i == n) return (j == 1 && l == 2); int v = (arr[i+1] - arr[i]) * (2*j - l) + k; if(v > m) return 0; z = 1ll * (2 * j - l) * mic(i+1, j, v, l) % M; z = (z + 1ll * (j + 1 - l) * mic(i+1, j+1, v, l)) % M; z = (z + 1ll * (2 - l) * mic(i+1, j+1, v, l+1)) % M; z = (z + 1ll * (2 - l) * mic(i+1, j, v, l+1)) % M; z = (z + 1ll * (j - 1) * mic(i+1, j-1, v, l)) % M; return z; } int main() { memset(dp, -1, sizeof dp); scanf("%d %d", &n, &m); for(int i = 1; i <= n; ++i) scanf("%d", arr+i); sort(arr+1, arr+n+1); arr[0] = arr[1]; printf("%d\n", mic(0, 0, 0, 0)); }

Compilation message (stderr)

skyscraper.cpp: In function 'int main()':
skyscraper.cpp:30:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d", &n, &m);
     ~~~~~^~~~~~~~~~~~~~~~~
skyscraper.cpp:31:38: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i = 1; i <= n; ++i) scanf("%d", arr+i);
                                 ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...