# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
129987 | TadijaSebez | 조교 (CEOI16_popeala) | C++11 | 341 ms | 14840 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N=20050;
const int K=52;
const ll inf=1e18;
ll dp[K][N],best[K],pts[N];
int last[N][K];
char res[K][N];
int main()
{
int n,t,s;
scanf("%i %i %i",&n,&t,&s);
for(int i=1;i<=t;i++) scanf("%lld",&pts[i]),pts[i]+=pts[i-1];
for(int i=1;i<=n;i++)
{
scanf("%s",res[i]+1);
for(int j=1;j<=t;j++) last[j][i]=res[i][j]=='1'?last[j-1][i]:j;
}
for(int j=1;j<=t;j++)
{
last[j][0]=j;
sort(last[j],last[j]+n+1);
}
for(int i=0;i<K;i++) for(int j=0;j<N;j++) dp[i][j]=inf;
dp[0][0]=0;
for(int i=1;i<=s;i++)
{
for(int i=0;i<K;i++) best[i]=inf;
for(int j=1;j<=t;j++)
{
for(int k=0;k<=n;k++)
{
for(int l=last[j-1][k];l<last[j][k];l++) best[k]=min(best[k],dp[i-1][l]-pts[l]*k);
dp[i][j]=min(dp[i][j],best[k]+pts[j]*k);
}
}
printf("%lld\n",dp[i][t]);
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |