#include <bits/stdc++.h>
using namespace std;
#define LCBorz ios_base::sync_with_stdio(false); cin.tie(0);
#define int long long
#define all(x) x.begin(), x.end()
#define endl '\n'
const int N=200005;
const int INF=1e18;
int32_t main() {
LCBorz;
int n,t,s;cin>>n>>t>>s;
vector<int> v(t+1);
for(int i=1;i<=t;i++){
cin>>v[i];
v[i]+=v[i-1];
}
vector pre(n,vector(t+1,0));
for(int i=0;i<n;i++){
for(int j=1;j<=t;j++){
char c;cin>>c;
pre[i][j]=c-'0'+pre[i][j-1];
}
}
auto f=[&](int l,int r){
int cnt=0;
for(int i=0;i<n;i++){
if(pre[i][r]-pre[i][l]==r-l){
cnt++;
}
}
return cnt;
};
vector dp(s+1,vector(t+1,INF));
dp[0][0]=0;
for(int i=1;i<=s;i++){
for(int j=1;j<=t;j++){
for(int k=0;k<j;k++){
int cnt=f(k,j);
cout<<cnt<<' ';
dp[i][j]=min(dp[i][j],dp[i-1][k]+cnt*(v[j]-v[k]));
}
cout<<endl;
}
}
for(int i=1;i<=s;i++){
cout<<dp[i][t]<<endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
600 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
557 ms |
14812 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2045 ms |
45224 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
600 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |