QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#364011 | #6696. Three Dice | wudibaolong# | WA | 0ms | 3788kb | C++14 | 774b | 2024-03-24 09:53:18 | 2024-03-24 09:53:18 |
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";
}
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";
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3532kb
input:
4 5
output:
Yes
result:
ok answer is YES
Test #2:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
3 0
output:
Yes
result:
ok answer is YES
Test #3:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
1 2
output:
No
result:
ok answer is NO
Test #4:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
0 0
output:
No
result:
ok answer is NO
Test #5:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
0 1
output:
No
result:
ok answer is NO
Test #6:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
0 2
output:
No
result:
ok answer is NO
Test #7:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
0 3
output:
No
result:
ok answer is NO
Test #8:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
0 4
output:
No
result:
ok answer is NO
Test #9:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
0 5
output:
No
result:
ok answer is NO
Test #10:
score: -100
Wrong Answer
time: 0ms
memory: 3608kb
input:
0 6
output:
No
result:
wrong answer expected YES, found NO