답안 #240574

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
240574 2020-06-20T06:23:43 Z Goolakh 조교 (CEOI16_popeala) C++17
8 / 100
55 ms 11008 KB
#include <bits/stdc++.h>
using namespace std;

#pragma GCC optimize("O2,no-stack-protector,unroll-loops,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("Os")

#define F first
#define S second
#define pb push_back
#define SZ(x) (ll)(x.size())
#define all(x) x.begin(),x.end()
//#define mp make_pair

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll maxn=50+10, maxm=2e4+10, lg=22, mod=1e9+9, inf=1e18;

ll n,t,s;
ll a[maxm],pre[maxm][maxn],dp[maxm][maxn],mnn[maxn][maxn];

int main(){
	ios_base::sync_with_stdio(0),cin.tie(0),cout.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++) pre[j][i]=(s[j-1]=='0' ? j:pre[j-1][i]);
	}
	for(int i=1;i<=t;i++) pre[i][n+1]=i, sort(pre[i]+1,pre[i]+n+1);
	memset(dp,69,sizeof(dp)), memset(mnn,69,sizeof(mnn));
	dp[0][0]=0;
	for(int i=1;i<=s;cout<<dp[i++][t]<<endl)for(int j=1;j<=t;j++)for(int k=0;k<=n;k++){
		for(int l=pre[j-1][k+1];l<pre[j][k+1];l++) mnn[k][i]=min(mnn[k][i],dp[i-1][l]-a[l]*k);
		if(pre[j][k+1]) dp[i][j]=min(dp[i][j],mnn[k][i]+a[j]*k);
	}
	
	return 0;
}



# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 9856 KB Output is correct
2 Correct 9 ms 9856 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 18 ms 9984 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 55 ms 11008 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 9856 KB Output is correct
2 Correct 9 ms 9856 KB Output is correct
3 Incorrect 18 ms 9984 KB Output isn't correct
4 Halted 0 ms 0 KB -