# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
165364 | Ruxandra985 | Popeala (CEOI16_popeala) | C++14 | 7 ms | 1784 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <cstdio>
#include <iostream>
#define INF 3000000000
using namespace std;
long long dp[51][20001];
long long ok[20010];
long long val[20010];
char res[51][20010];
int biti1 (long long x){
int sol = 0;
while (x){
sol = sol + (x&1);
x/=2;
}
return sol;
}
int main()
{
FILE *fin = stdin;
FILE *fout = stdout;
int n,t,s,i,j,k,nr,p;
fscanf (fin,"%d%d%d",&n,&t,&s);
for (i=1;i<=t;i++){
fscanf (fin,"%lld",&val[i]);
val[i]+=val[i-1];
}
fgetc(fin);
for (i=1;i<=n;i++){
for (j=1;j<=t;j++)
res[i][j] = fgetc(fin);
fgetc(fin);
}
for (i=0;i<=t;i++)
for (j=0;j<=s;j++)
dp[i][j] = INF;
dp[0][0] = 0;
for (i=1;i<=t;i++){
for (j=1;j<=s;j++){
for (k=1;k<=n;k++)
ok[k] = 1;
nr = n;
for (k=i;k;k--){ /// in subtaskul j sunt testele i..k
for (p = 1 ; p<=n ; p++){
if (ok[p] && res[p][k]=='0'){
ok[p] = 0;
nr--;
}
}
dp[i][j] = min(dp[i][j] , dp[k-1][j-1] + nr * (val[i] - val[k-1]));
}
}
}
for (j=1;j<=s;j++)
fprintf (fout,"%lld\n",dp[t][j]);
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... |