Submission #536821

# Submission time Handle Problem Language Result Execution time Memory
536821 2022-03-14T05:27:29 Z zaneyu Popeala (CEOI16_popeala) C++17
17 / 100
2000 ms 1108 KB
/*input
2 3 3
4 3 5
101
110
*/
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define MNTO(x,y) x=min(x,y)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define ll long long
const int maxn=2e4+5;
ll dp[maxn],ndp[maxn];
bool ok[maxn];
int arr[maxn];
string s[maxn];
int main(){
    ios::sync_with_stdio(false),cin.tie(0);
    int n,m,S;
    cin>>n>>m>>S;
    REP1(i,m) cin>>arr[i];
    REP(i,n) cin>>s[i],s[i]="0"+s[i];
    REP1(i,m) ndp[i]=dp[i]=INT_MAX;
    REP1(asd,S){
        REP1(i,m){
            ndp[i]=INT_MAX;
            int cnt=n;
            int sum=0;
            REP(a,n) ok[a]=1;
            for(int j=i;j>=0;j--){
                if(j!=i) MNTO(ndp[i],dp[j]+1LL*cnt*sum);
                sum+=arr[j];
                cnt=0;
                REP(a,n){
                    if(s[a][j]=='0') ok[a]=0;
                    if(ok[a]) ++cnt;
                }
            }
        }
        REP1(i,m) dp[i]=ndp[i];
        dp[0]=INT_MAX;
        cout<<ndp[m]<<'\n';
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 852 KB Output is correct
2 Correct 1 ms 852 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 390 ms 980 KB Output is correct
2 Correct 344 ms 1012 KB Output is correct
3 Correct 371 ms 1020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 2069 ms 1108 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 852 KB Output is correct
2 Correct 1 ms 852 KB Output is correct
3 Correct 390 ms 980 KB Output is correct
4 Correct 344 ms 1012 KB Output is correct
5 Correct 371 ms 1020 KB Output is correct
6 Execution timed out 2069 ms 1108 KB Time limit exceeded
7 Halted 0 ms 0 KB -