제출 #133456

#제출 시각아이디문제언어결과실행 시간메모리
133456win11905Skyscraper (JOI16_skyscraper)C++11
15 / 100
221 ms260620 KiB
#include <bits/stdc++.h> #define long long long using namespace std; const long M = 1e9+7; const int N = 105; const int L = 1005; int n, m; int arr[N]; long dp[N][N][L][3]; long mic(int i, int j, int k, int l) { if(i != 0 && (j <= 0 || l > 2)) return 0; long &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 = (2 * j - l) * mic(i+1, j, v, l) % M; z = (z + (j + 1 - l) * mic(i+1, j+1, v, l)) % M; z = (z + (2 - l) * mic(i+1, j+1, v, l+1)) % M; z = (z + (2 - l) * mic(i+1, j, v, l+1)) % M; z = (z + (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("%lld\n", mic(0, 0, 0, 0)); }

컴파일 시 표준 에러 (stderr) 메시지

skyscraper.cpp: In function 'int main()':
skyscraper.cpp:31: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:32: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...