Submission #1032704

# Submission time Handle Problem Language Result Execution time Memory
1032704 2024-07-24T06:33:25 Z 변재우(#10969) Popeala (CEOI16_popeala) C++17
0 / 100
319 ms 8716 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;

const int Kmax=55, Nmax=20010, INF=1e18;
int N, T, S, A[Nmax], D[Kmax][Nmax];
int R[Nmax];

signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>N>>T>>S;
    for(int i=1; i<=T; i++) cin>>A[i], A[i]+=A[i-1];
    for(int i=1; i<=N; i++) {
        string s; cin>>s;
        for(int j=1; j<=T; j++) if(s[j-1]=='1') R[j]+=(1<<(i-1));
    }
    for(int i=0; i<=S; i++) for(int j=0; j<=T; j++) D[i][j]=INF;
    D[0][0]=0;
    for(int i=1; i<=S; i++) {
        for(int j=1; j<=T; j++) {
            int P=(1<<N)-1;
            for(int k=j; k>=1; k--) {
                P&=R[k];
                D[i][j]=min(D[i][j], D[i-1][k-1]+(A[j]-A[k-1])*__builtin_popcountll(P));
            }
        }
    }
    for(int i=1; i<=S; i++) cout<<D[i][T]<<"\n";
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Incorrect 1 ms 4444 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 8536 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 319 ms 8716 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Incorrect 1 ms 4444 KB Output isn't correct
3 Halted 0 ms 0 KB -