QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#460689#5535. Popealafryan#0 689ms11820kbC++202.0kb2024-07-02 03:16:302024-07-02 03:16:31

Judging History

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

  • [2024-07-02 03:16:31]
  • 评测
  • 测评结果:0
  • 用时:689ms
  • 内存:11820kb
  • [2024-07-02 03:16: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][mxn];

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";
			wat.resize(0);
			wat.push_back(t);
			for (int k = 0; k < n; k++) {
				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 (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
Runtime Error

Test #1:

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

input:

2 3 3
4 3 5
101
110

output:

0
8
16

result:

ok 3 lines

Test #2:

score: -8
Runtime Error

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:


result:


Subtask #2:

score: 0
Wrong Answer

Test #3:

score: 0
Wrong Answer
time: 171ms
memory: 11580kb

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
109170
444186
578826
846618
1029437
1369373
1928532
2213076
2629583
2655644
3569940
3947445
4304025
4383467
5153867
5456915
5781491
6367661
6552505
6718560
6842754
6910056
7036674
7382802
7663170
7952643
8201917
8581453
8973189
9060938
9649134
9729312
9875822
10312094
10448864
10893766
11311366
11...

result:

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

Subtask #3:

score: 0
Wrong Answer

Test #6:

score: 0
Wrong Answer
time: 689ms
memory: 11820kb

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
170550
440578
502003
786421
1058525
1246537
1281341
1537121
1794132
2172312
2641701
2910957
2944179
3188591
3433648
3899051
4108764
4233286
4411172
4655584
4852952
4977474
5221886
5466943
5884675
6094455
6215245
6458677
6573874
6845926
6959433
7202865
7318062
7562474
7807531
8242721
8487133
873219...

result:

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

Subtask #4:

score: 0
Skipped

Dependency #1:

0%