Submission #134180

# Submission time Handle Problem Language Result Execution time Memory
134180 2019-07-22T08:03:40 Z 송준혁(#3232) Popeala (CEOI16_popeala) C++14
26 / 100
2000 ms 11320 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;

int N, M, K;
LL S[20202];
LL D[20202][60];
int P[20202][60], tmp[60];

int main(){
	scanf("%d %d %d", &M, &N, &K);
	for (int i=1; i<=N; i++){
		scanf("%d", &S[i]);
		S[i] += S[i-1];
	}
	for (int i=1; i<=M; i++) for (int j=1; j<=N; j++){
		scanf("%1d", &P[j][i]);
		if (P[j][i] == 0) P[j][i] = j;
		else P[j][i] = P[j-1][i];
	}
	for (int i=1; i<=N; i++) sort(P[i]+1, P[i]+M+1);
	memset(D, 1, sizeof D);
	D[0][0] = 0;
	for (int i=1; i<=N; i++) for (int j=1; j<=K; j++){
		int t=0;
		for (int k=1; k<=i; k++){
			while (t < M && P[i][t+1] < k) t++;
			D[i][j] = min(D[i][j], D[k-1][j-1] + (S[i]-S[k-1]) * t);
		}
	}
	for (int i=1; i<=K; i++) printf("%lld\n", D[N][i]);
	return 0;
} 

Compilation message

popeala.cpp: In function 'int main()':
popeala.cpp:14:20: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'LL* {aka long long int*}' [-Wformat=]
   scanf("%d", &S[i]);
               ~~~~~^
popeala.cpp:12:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d %d", &M, &N, &K);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
popeala.cpp:14:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &S[i]);
   ~~~~~^~~~~~~~~~~~~
popeala.cpp:18:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%1d", &P[j][i]);
   ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 9 ms 9848 KB Output is correct
2 Correct 10 ms 9848 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 35 ms 9976 KB Output is correct
2 Correct 35 ms 9972 KB Output is correct
3 Correct 35 ms 9948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 427 ms 10360 KB Output is correct
2 Correct 797 ms 10580 KB Output is correct
3 Correct 1526 ms 10820 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 9848 KB Output is correct
2 Correct 10 ms 9848 KB Output is correct
3 Correct 35 ms 9976 KB Output is correct
4 Correct 35 ms 9972 KB Output is correct
5 Correct 35 ms 9948 KB Output is correct
6 Correct 427 ms 10360 KB Output is correct
7 Correct 797 ms 10580 KB Output is correct
8 Correct 1526 ms 10820 KB Output is correct
9 Execution timed out 2035 ms 11320 KB Time limit exceeded
10 Halted 0 ms 0 KB -