QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#460692#5535. Popealafryan#0 801ms13288kbC++202.1kb2024-07-02 03:29:302024-07-02 03:29:31

Judging History

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

  • [2024-07-02 03:29:31]
  • 评测
  • 测评结果:0
  • 用时:801ms
  • 内存:13288kb
  • [2024-07-02 03:29:30]
  • 提交

answer

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <chrono>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#include <iostream>

using namespace std;
#define int long long
#define all(x) begin(x), end(x)
#define sz(x) (int) (x).size()

const int inf = 1e9;
const int mxt = 2e4+5;
const int mxn = 51;

int n,t,s;
int pt[mxt];
vector<int> wa[mxn];
int np[mxn];
int dp[mxt+10][mxn+10];

int range_sum(int l, int r) {
	assert(l <= r);
	return pt[r] - (l ? pt[l-1] : 0);
}

void solve(int nt) {
	for (int i = 0; i < mxt; i++) {
		for (int j = 0; j < mxn; j++) {
			dp[i][j] = inf;
		}
	}
	memset(np, 0, sizeof(np));
	dp[0][0] = 0;
	vector<int> wat;
	for (int i = 0; i <= t; i++) {
		for (int j = 0; j <= nt; j++) {
			if (dp[i][j] == inf) continue;
	//		cout << "\n" << i << " " << j << " - " << dp[i][j] << ":\n" << flush;
			dp[i+1][j+1] = min(dp[i+1][j+1], dp[i][j] + n*range_sum(i,i));
			wat.resize(0);
			wat.push_back(t);
			for (int k = 0; k < n; k++) {
				if (!sz(wa[k])) continue;
				if (np[k] < sz(wa[k])) wat.push_back(wa[k][np[k]]);
			}
			sort(all(wat));
			for (int k = 0; k < sz(wat); k++) {
				int tt = wat[k];
	//			cout << tt << " ";
				if (tt == i) continue;
				dp[tt][j + 1] = min(dp[tt][j + 1], dp[i][j] + range_sum(i, tt - 1) * (n - k));
			}
//			cout << "\n";
		}
		for (int j = 0; j < n; j++) {
			if (np[j] >= sz(wa[j])) continue;
			if (wa[j][np[j]] == i) {
				np[j]++;
			}
		}
	}
	cout << dp[t][nt] << "\n";
}

signed main() {
	cin >> n >> t >> s;
	for (int i = 0; i < t; i++) {
		cin >> pt[i];
		if (i) {
			pt[i] += pt[i - 1];
		}
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < t; j++) {
			char c;
			cin >> c;
			if (c == '0') {
				wa[i].push_back(j);
			}
		}
//		wa[i].push_back(t);
	}
	for (int i = 1; i <= s; i++) {
		solve(i);
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 8
Accepted
time: 4ms
memory: 13288kb

input:

2 3 3
4 3 5
101
110

output:

0
8
16

result:

ok 3 lines

Test #2:

score: -8
Wrong Answer
time: 8ms
memory: 13068kb

input:

35 40 15
3657 2870 9633 4742 6403 1197 1327 9983 5095 1033 2356 2681 9948 6851 6494 1965 6698 5860 8718 3453 9739 5794 7452 9556 5798 5141 4009 1869 2474 6480 8270 6280 4446 8052 2155 3226 1667 843 2851 6305
1001111110101111111111111110111111111111
1111111111111111111111111111111111111111
1111111111...

output:

2237081
2324849
2393729
2596022
2709830
2857598
2886792
2920227
3139853
3227369
3267508
3314628
3523323
3762741
3796725

result:

wrong answer 3rd lines differ - expected: '2390859', found: '2393729'

Subtask #2:

score: 0
Wrong Answer

Test #3:

score: 0
Wrong Answer
time: 204ms
memory: 13080kb

input:

50 500 50
2038 388 7128 2805 5579 3731 7082 6271 5626 5928 8728 304 2767 8798 8311 8389 7924 1727 8612 7438 6588 7056 4588 3823 4615 4201 6337 370 1178 2694 7211 5841 6159 5419 7907 7080 1436 1867 4643 7361 1743 3185 9089 2317 593 9466 8700 9757 8776 8077 1274 1951 4362 1077 3344 2876 4067 1267 8350...

output:

0
101900
120136
455152
589792
857584
1040403
1380339
1693889
1969563
2254107
2666610
2696675
2835025
3274925
3665542
4043047
4399627
4479069
4909669
5274131
5577179
5901755
6131155
6322305
6539210
6724054
6977300
7026239
7081605
7208223
7554351
7834719
8124192
8373466
8753002
9107002
9175930
9263679...

result:

wrong answer 2nd lines differ - expected: '95786', found: '101900'

Subtask #3:

score: 0
Wrong Answer

Test #6:

score: 0
Wrong Answer
time: 801ms
memory: 13204kb

input:

48 2200 50
337 3453 6137 1365 4085 2098 573 5755 4273 791 629 3815 1240 5977 8595 9987 9020 5999 9071 655 8343 4000 5410 3356 4673 7505 8440 259 5473 9902 7131 1896 8264 816 2911 1052 8757 5517 4111 9878 7684 3757 5880 6524 6338 7356 1354 3100 9447 8440 8994 4598 1942 7759 3915 3175 980 5528 3090 77...

output:

0
16176
175014
445042
506467
702547
799055
826559
1085534
1273546
1308350
1338542
1521662
1579942
1836953
2215133
2684522
3000122
3175612
3231412
3476469
3910293
4083976
4204360
4449417
4591291
4716481
4961538
5082789
5258279
5314079
5551247
5796304
6056992
6375427
6550917
6606717
6851774
6956220
70...

result:

wrong answer 2nd lines differ - expected: '0', found: '16176'

Subtask #4:

score: 0
Skipped

Dependency #1:

0%