답안 #1031515

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1031515 2024-07-22T23:16:47 Z vjudge1 Skyscraper (JOI16_skyscraper) C++17
15 / 100
154 ms 179072 KB
#include<bits/stdc++.h>
using namespace std;
//int dp0[101][51],dp1[105][51],dp2[101][51];
long long cnt[1<<14][14][101];
int vl[14],mod=1e9+7;
int main(){
    int n,l;
    cin>>n>>l;
    for(int i=0;i<n;i++)
        cin>>vl[i],cnt[1<<i][i][0]=1;
    for(int i=1;i<1<<n;i++)
        for(int j=0;j<n;j++)if(i&1<<j) {
            for(int k=0;k<=l;k++)
                cnt[i][j][k]%=mod;
            for(int k=0;k<n;k++)if(~i&1<<k){
                int cst=abs(vl[j]-vl[k]);
                for(int v=0;v<=l-cst;v++)
                    cnt[i^1<<k][k][v+cst]+=cnt[i][j][v];
            }
        }
    long long ans=0;
    for(int i=0;i<=l;i++)
        for(int x=0;x<n;x++)
            ans+=cnt[(1<<n)-1][x][i];
    cout<<ans%mod;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 440 KB Output is correct
4 Correct 0 ms 856 KB Output is correct
5 Incorrect 4 ms 3164 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 43784 KB Output is correct
2 Correct 126 ms 179028 KB Output is correct
3 Correct 101 ms 177232 KB Output is correct
4 Correct 135 ms 179072 KB Output is correct
5 Correct 154 ms 179028 KB Output is correct
6 Correct 131 ms 178736 KB Output is correct
7 Correct 90 ms 176848 KB Output is correct
8 Correct 100 ms 177188 KB Output is correct
9 Correct 123 ms 178256 KB Output is correct
10 Correct 120 ms 178460 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 440 KB Output is correct
4 Correct 0 ms 856 KB Output is correct
5 Incorrect 4 ms 3164 KB Output isn't correct
6 Halted 0 ms 0 KB -