답안 #134198

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
134198 2019-07-22T08:15:57 Z 송준혁(#3232) 조교 (CEOI16_popeala) C++14
8 / 100
1078 ms 10400 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;
		vector<int> V;
		for (int k=0; k<=M; k++) for (int l=0; l<=min(j, 10); l++) V.push_back(P[i][k]+l);
		V.push_back(i);
		sort(V.begin(), V.end());
		V.erase(unique(V.begin(), V.end()), V.end());
		for (int k : V){
			if (k == 0) continue;
			if (k > i) break;
			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]);
   ~~~~~^~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 9848 KB Output is correct
2 Correct 17 ms 9848 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 265 ms 10104 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1078 ms 10400 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 9848 KB Output is correct
2 Correct 17 ms 9848 KB Output is correct
3 Incorrect 265 ms 10104 KB Output isn't correct
4 Halted 0 ms 0 KB -