Submission #1046788

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
10467882024-08-06 23:44:27idiotcomputerSkyscraper (JOI16_skyscraper)C++11
20 / 100
366 ms524288 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
const ll mod = 1e9+7;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n,l;
cin >> n >> l;
vector<int> h(n);
for (int i = 0; i < n; i++) cin >> h[i];
sort(h.begin(),h.end());
//2000 is 0
ll dp[n][n+1][3005][3];
memset(dp,0,sizeof(dp));
dp[0][1][2000-2*h[0]][2] = 1;
dp[0][1][2000-h[0]][1] = 2;
int v;
for (int i = 1; i < n; i++){
for (int j = 1; j < n; j++){
for (int k = 0; k < 3005; k++){
//appending
dp[i][j][k][0] += dp[i-1][j][k][0] * 2 * (j-1);
dp[i][j][k][1] += dp[i-1][j][k][1] * (2 * j - 1);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...