QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#364016 | #6696. Three Dice | wudibaolong# | WA | 1ms | 3844kb | C++14 | 787b | 2024-03-24 09:55:57 | 2024-03-24 09:55:58 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
signed main() {
int A, b; cin >> A >> b;
int m;
if (A <= 3) {
m = A;
} else {
m = A / 4 + A % 4;
}
if (m > 3) {
cout << "No";
return 0;
}
m = 3 - m;
vector<int> a{0, 2, 3, 5, 6};
vector<vector<vector<int>>> dp(5, vector<vector<int>>(m + 5, vector<int>(100)));
dp[0][0][0] = 1;
for (int i = 1; i <= 4; ++i) {
for (int j = 0; j <= m; ++j) {
for (int z = 0; z <= m * 6; ++z) {
dp[i][j][z] |= dp[i - 1][j][z];
if (j >= 1 and z >= a[i])
dp[i][j][z] |= dp[i - 1][j - 1][z - a[i]];
}
}
// cout << dp[i][0][0] << "\n";
}
// cout << b << '\n';
// cout << m << " " << dp[4][m][b] << "\n";
if (dp[4][m][b]) {
cout << "Yes";
} else {
cout << "No";
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3836kb
input:
4 5
output:
Yes
result:
ok answer is YES
Test #2:
score: 0
Accepted
time: 1ms
memory: 3608kb
input:
3 0
output:
Yes
result:
ok answer is YES
Test #3:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
1 2
output:
No
result:
ok answer is NO
Test #4:
score: 0
Accepted
time: 1ms
memory: 3844kb
input:
0 0
output:
No
result:
ok answer is NO
Test #5:
score: 0
Accepted
time: 0ms
memory: 3532kb
input:
0 1
output:
No
result:
ok answer is NO
Test #6:
score: 0
Accepted
time: 0ms
memory: 3528kb
input:
0 2
output:
No
result:
ok answer is NO
Test #7:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
0 3
output:
No
result:
ok answer is NO
Test #8:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
0 4
output:
No
result:
ok answer is NO
Test #9:
score: 0
Accepted
time: 0ms
memory: 3548kb
input:
0 5
output:
No
result:
ok answer is NO
Test #10:
score: -100
Wrong Answer
time: 1ms
memory: 3548kb
input:
0 6
output:
No
result:
wrong answer expected YES, found NO