QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#460694 | #5535. Popeala | fryan# | 0 | 22ms | 13668kb | C++20 | 1.3kb | 2024-07-02 03:34:57 | 2024-07-02 03:34:58 |
Judging History
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];
signed 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
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 12252kb
input:
2 3 3 4 3 5 101 110
output:
0 8 8
result:
wrong answer 3rd lines differ - expected: '16', found: '8'
Subtask #2:
score: 0
Wrong Answer
Test #3:
score: 0
Wrong Answer
time: 5ms
memory: 12592kb
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 52988 -3169343104 -3233806779 -3233806779 -3298205354 -3362603929 -3362603929 -3427002504 -3491401079 -3491401079 -3555799654 -3620198229 -3620198229 -3684596804 -3748995379 -3748995379 -3813393954 -3877792529 -3877792529 -3942191104 -4006589679 -4006589679 -4070988254 -4135386829 -4135386829 -419...
result:
wrong answer 2nd lines differ - expected: '95786', found: '52988'
Subtask #3:
score: 0
Wrong Answer
Test #6:
score: 0
Wrong Answer
time: 22ms
memory: 13668kb
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 0 -2972106505 -3233849641 -3233849641 -3495446737 -3757043833 -3757043833 -4018640929 -4280238025 -4280238025 -7267073801 -7528816937 -7528816937 -7790414033 -8052011129 -8052011129 -8313608225 -8575205321 -8575205321 -11562041097 -11823784233 -11823784233 -12085381329 -12346978425 -12346978425 -1...
result:
wrong answer 3rd lines differ - expected: '0', found: '-2972106505'
Subtask #4:
score: 0
Skipped
Dependency #1:
0%