QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#460693#5535. Popealafryan#Compile Error//C++201.3kb2024-07-02 03:34:302024-07-02 03:34:30

Judging History

你现在查看的是最新测评结果

  • [2024-07-02 03:34:30]
  • 评测
  • [2024-07-02 03:34:30]
  • 提交

answer

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <chrono>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
#define int long long
#define all(x) begin(x), end(x)
#define sz(x) (int) (x).size()

const int mxn=50, mxt=2e4, mxs=50;
int n, t, s, p[mxt+1], dp[mxs+1][mxt+1], a[mxt+1][mxn+1], b[mxn+1];
string r[mxn];

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);

	cin >> n >> t >> s;
	for(int i=0; i<t; ++i)
		cin >> p[i+1], p[i+1]+=p[i];
	for(int i=0; i<n; ++i)
		cin >> r[i];
	for(int i=0; i<t; ++i)
		for(int j=0; j<n; ++j)
			a[i+1][j]=r[j][i]&1?a[i][j]:i+1;
	for(int i=1; i<=t; ++i) {
		a[i][n]=i;
		sort(a[i], a[i]+n+1);
	}
	memset(dp, 0x3f, sizeof(dp));
	dp[0][0]=0;
	for(int i=1; i<=s; ++i) {
		memset(b, 0x3f, 4*n+4);
		for(int j=1; j<=t; ++j) {
			for(int k=0; k<=n; ++k) {
				for(int l=a[j-1][k]; l<a[j][k]; ++l)
					b[k]=min(dp[i-1][l]-p[l]*k, b[k]);
				dp[i][j]=min(b[k]+p[j]*k, dp[i][j]);
			}
		}
		cout << dp[i][t] << "\n";
	}
}

Details

cc1plus: error: ‘::main’ must return ‘int’