QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#312577 | #5146. Skills | XiaoTie | WA | 369ms | 143596kb | C++20 | 2.7kb | 2024-01-24 00:52:04 | 2024-01-24 00:52:05 |
Judging History
answer
#include <bits/stdc++.h>
#pragma GCC optimize(3)
#define int long long
#define llu unsigned long long
#define endl "\n"
#define inf 0x3f3f3f3f
#define debug cout << "****************" << endl
using namespace std;
typedef pair<int, int> PII;
const int N = 1010;
const int m = 201;
// int dp[210][210][210];
// int f[210][210][210];
void solve()
{
int n;
cin >> n;
vector<vector<vector<int>>> f(m + 5, vector<vector<int>>(m + 5, vector<int>(m + 5, 0)));
vector<vector<vector<int>>> dp(m + 5, vector<vector<int>>(m + 5, vector<int>(m + 5, 0)));
int ans = 0;
vector<array<int, 4>> a(n + 7);
for (int i = 1; i <= n; i++)
cin >> a[i][1] >> a[i][2] >> a[i][3];
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= 3; j++)
{
for (int t1 = 0; t1 <= m && t1 <= i; t1++)
{
for (int t2 = 0; t2 <= m && t2 <= i; t2++)
{
if (j == 1)
{
ans = max(ans, dp[1][(t1 ? t1 + 1 : 0)][t2 ? t2 + 1 : 0] = max(dp[1][(t1 ? t1 + 1 : 0)][t2 ? t2 + 1 : 0], f[1][t1][t2] + a[i][1] - t1 - t2));
ans = max(ans, dp[1][2][t2 ? t2 + 1 : 0] = max(dp[1][2][t2 ? t2 + 1 : 0], f[t1][1][t2] + a[i][1] - 1 - t2));
ans = max(ans, dp[1][t2 ? t2 + 1 : 0][2] = max(dp[1][t2 ? t2 + 1 : 0][2], f[t1][t2][1] + a[i][1] - 1 - t2));
}
if (j == 2)
{
ans = max(ans, dp[2][1][t2 ? t2 + 1 : 0] = max(dp[2][1][t2 ? t2 + 1 : 0], f[1][t1][t2] + a[i][2] - t2 - 1));
ans = max(ans, dp[(t1 ? t1 + 1 : 0)][1][t2 ? t2 + 1 : 0] = max(dp[(t1 ? t1 + 1 : 0)][1][t2 ? t2 + 1 : 0], f[t1][1][t2] + a[i][2] - t1 - t2));
ans = max(ans, dp[(t1 ? t1 + 1 : 0)][1][2] = max(dp[(t1 ? t1 + 1 : 0)][1][2], f[t1][t2][1] + a[i][2] - t1 - 1));
}
if (j == 3)
{
ans = max(ans, dp[2][(t1 ? t1 + 1 : 0)][1] = max(dp[2][(t1 ? t1 + 1 : 0)][1], f[1][t1][t2] + a[i][3] - t1 - 1));
ans = max(ans, dp[(t1 ? t1 + 1 : 0)][2][1] = max(dp[(t1 ? t1 + 1 : 0)][2][1], f[t1][1][t2] + a[i][3] - 1 - t1));
ans = max(ans, dp[(t1 ? t1 + 1 : 0)][t2 ? t2 + 1 : 0][1] = max(dp[(t1 ? t1 + 1 : 0)][t2 ? t2 + 1 : 0][1], f[t1][t2][1] + a[i][3] - t1 - t2));
}
}
}
}
swap(f, dp);
}
cout << ans << endl;
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int T = 1;
cin >> T;
while (T--)
solve();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 24ms
memory: 143332kb
input:
2 3 1 1 10 1 10 1 10 1 1 5 1 2 3 6 5 4 7 8 9 12 11 10 13 14 15
output:
26 41
result:
ok 2 number(s): "26 41"
Test #2:
score: 0
Accepted
time: 88ms
memory: 143584kb
input:
1 200 6219 3608 2383 1139 2158 8611 6721 8216 8887 8736 6707 9755 7210 248 167 3849 276 8050 971 5062 1914 8290 1562 6017 8993 7990 3460 6323 6099 757 7652 4740 6117 6560 4206 180 3705 8906 5752 9619 8939 9696 793 6680 1777 384 3606 8772 9258 3906 709 4396 5083 6614 6057 4410 3132 8596 825 7437 6098...
output:
1505431
result:
ok 1 number(s): "1505431"
Test #3:
score: 0
Accepted
time: 80ms
memory: 143588kb
input:
1 200 7577 2771 7429 8435 7489 1440 1929 8819 818 7849 8462 8761 3344 5938 3673 9434 8897 6486 4668 636 8139 4777 3305 4238 4221 3326 639 3879 7469 1590 6370 9514 4307 6243 3301 8122 4967 184 9327 6142 1710 399 6814 9296 6270 5663 3564 5442 8315 1295 869 2635 7975 4837 9613 9439 4012 6660 1861 368 8...
output:
1497632
result:
ok 1 number(s): "1497632"
Test #4:
score: 0
Accepted
time: 174ms
memory: 143548kb
input:
1 300 0 10000 0 0 10000 0 0 10000 0 10000 0 0 0 0 10000 10000 0 0 0 0 10000 10000 0 0 0 0 10000 10000 0 0 0 0 10000 10000 0 0 0 0 10000 10000 0 0 0 0 10000 10000 0 0 0 0 10000 10000 0 0 0 0 10000 10000 0 0 0 0 10000 10000 0 0 0 0 10000 10000 0 0 0 0 10000 10000 0 0 0 0 10000 10000 0 0 0 0 10000 1000...
output:
2975228
result:
ok 1 number(s): "2975228"
Test #5:
score: 0
Accepted
time: 369ms
memory: 143488kb
input:
1 500 10000 0 0 10000 0 0 10000 0 0 0 10000 0 0 0 10000 0 10000 0 0 0 10000 0 10000 0 0 0 10000 0 10000 0 0 0 10000 0 10000 0 0 0 10000 0 10000 0 0 0 10000 0 10000 0 0 0 10000 0 10000 0 0 0 10000 0 10000 0 0 0 10000 0 10000 0 0 0 10000 0 10000 0 0 0 10000 0 10000 0 0 0 10000 0 10000 0 0 0 10000 0 10...
output:
4955301
result:
ok 1 number(s): "4955301"
Test #6:
score: -100
Wrong Answer
time: 251ms
memory: 143596kb
input:
20 10 6219 3608 2383 1139 2158 8611 6721 8216 8887 8736 6707 9755 7210 248 167 3849 276 8050 971 5062 1914 8290 1562 6017 8993 7990 3460 0 0 0 10 7652 4740 6117 6560 4206 180 3705 8906 5752 9619 8939 9696 793 6680 1777 384 3606 8772 9258 3906 709 4396 5083 6614 6057 4410 3132 1 0 0 10 6098 4958 7691...
output:
71058 70170 68633 74398 65916 65053 62882 65101 62730 71037 64502 71948 54366 66300 74357 70246 65961 78875 58700 72180
result:
wrong answer 1st numbers differ - expected: '71054', found: '71058'