QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#251388#6696. Three DiceTeal#AC ✓1ms3548kbC++141.1kb2023-11-14 17:36:562023-11-14 17:36:56

Judging History

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

  • [2023-11-14 17:36:56]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3548kb
  • [2023-11-14 17:36:56]
  • 提交

answer

#include <set>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define N ()
#define inf (0x3f3f3f3f)
#define INF (0x3f3f3f3f3f3f3f3fll)
#define LL long long
int A, B, Red, Black;
int a[5] = {0, 2, 3, 5, 6};

inline int read() {
    int x = 0, f = 1; char ch = getchar();
    while (ch < '0' || ch > '9')
        ch == '-' ? f = -1, ch = getchar() : ch = getchar();
    while (ch >= '0' && ch <= '9')
        x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
    return x * f;
}

bool dfs(int x, int res) {
    if (x == 0) return res == 0;
    bool ans = 0;
    for (int i = 1; i <= 4; ++i) {
        if (res >= a[i]) ans |= dfs(x - 1, res - a[i]);
    }
    return ans;
}

int main() {
    A = read(), B = read();
    if (A == 0) Red = 0;
    else if (A == 1 || A == 4) Red = 1;
    else if (A == 2 || A == 5 || A == 8) Red = 2;
    else if (A == 6 || A == 3 || A == 9 || A == 12) Red = 3;
    else Red = -1;
    if (Red == -1) puts("No"), exit(0);

    Black = 3 - Red;
    if (dfs(Black, B)) puts("Yes");
    else puts("No");
    return 0;
}

这程序好像有点Bug,我给组数据试试?

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3540kb

input:

4 5

output:

Yes

result:

ok answer is YES

Test #2:

score: 0
Accepted
time: 0ms
memory: 3336kb

input:

3 0

output:

Yes

result:

ok answer is YES

Test #3:

score: 0
Accepted
time: 0ms
memory: 3476kb

input:

1 2

output:

No

result:

ok answer is NO

Test #4:

score: 0
Accepted
time: 0ms
memory: 3548kb

input:

0 0

output:

No

result:

ok answer is NO

Test #5:

score: 0
Accepted
time: 0ms
memory: 3416kb

input:

0 1

output:

No

result:

ok answer is NO

Test #6:

score: 0
Accepted
time: 1ms
memory: 3420kb

input:

0 2

output:

No

result:

ok answer is NO

Test #7:

score: 0
Accepted
time: 1ms
memory: 3316kb

input:

0 3

output:

No

result:

ok answer is NO

Test #8:

score: 0
Accepted
time: 1ms
memory: 3384kb

input:

0 4

output:

No

result:

ok answer is NO

Test #9:

score: 0
Accepted
time: 0ms
memory: 3340kb

input:

0 5

output:

No

result:

ok answer is NO

Test #10:

score: 0
Accepted
time: 0ms
memory: 3420kb

input:

0 6

output:

Yes

result:

ok answer is YES

Test #11:

score: 0
Accepted
time: 0ms
memory: 3312kb

input:

0 7

output:

Yes

result:

ok answer is YES

Test #12:

score: 0
Accepted
time: 0ms
memory: 3496kb

input:

0 8

output:

Yes

result:

ok answer is YES

Test #13:

score: 0
Accepted
time: 0ms
memory: 3496kb

input:

0 9

output:

Yes

result:

ok answer is YES

Test #14:

score: 0
Accepted
time: 0ms
memory: 3340kb

input:

0 10

output:

Yes

result:

ok answer is YES

Test #15:

score: 0
Accepted
time: 0ms
memory: 3336kb

input:

0 11

output:

Yes

result:

ok answer is YES

Test #16:

score: 0
Accepted
time: 0ms
memory: 3256kb

input:

0 12

output:

Yes

result:

ok answer is YES

Test #17:

score: 0
Accepted
time: 0ms
memory: 3304kb

input:

1 0

output:

No

result:

ok answer is NO

Test #18:

score: 0
Accepted
time: 0ms
memory: 3536kb

input:

1 1

output:

No

result:

ok answer is NO

Test #19:

score: 0
Accepted
time: 1ms
memory: 3308kb

input:

1 4

output:

Yes

result:

ok answer is YES

Test #20:

score: 0
Accepted
time: 1ms
memory: 3324kb

input:

1 6

output:

Yes

result:

ok answer is YES

Test #21:

score: 0
Accepted
time: 1ms
memory: 3548kb

input:

1 7

output:

Yes

result:

ok answer is YES

Test #22:

score: 0
Accepted
time: 0ms
memory: 3548kb

input:

1 8

output:

Yes

result:

ok answer is YES

Test #23:

score: 0
Accepted
time: 0ms
memory: 3496kb

input:

2 3

output:

Yes

result:

ok answer is YES

Test #24:

score: 0
Accepted
time: 0ms
memory: 3312kb

input:

2 4

output:

No

result:

ok answer is NO

Test #25:

score: 0
Accepted
time: 0ms
memory: 3420kb

input:

2 6

output:

Yes

result:

ok answer is YES

Test #26:

score: 0
Accepted
time: 0ms
memory: 3492kb

input:

2 8

output:

No

result:

ok answer is NO

Test #27:

score: 0
Accepted
time: 1ms
memory: 3380kb

input:

3 1

output:

No

result:

ok answer is NO

Test #28:

score: 0
Accepted
time: 0ms
memory: 3240kb

input:

0 18

output:

Yes

result:

ok answer is YES

Test #29:

score: 0
Accepted
time: 0ms
memory: 3308kb

input:

4 12

output:

Yes

result:

ok answer is YES

Test #30:

score: 0
Accepted
time: 0ms
memory: 3360kb

input:

4 11

output:

Yes

result:

ok answer is YES

Test #31:

score: 0
Accepted
time: 1ms
memory: 3532kb

input:

5 2

output:

Yes

result:

ok answer is YES

Test #32:

score: 0
Accepted
time: 0ms
memory: 3320kb

input:

5 3

output:

Yes

result:

ok answer is YES

Test #33:

score: 0
Accepted
time: 0ms
memory: 3376kb

input:

5 4

output:

No

result:

ok answer is NO

Test #34:

score: 0
Accepted
time: 0ms
memory: 3380kb

input:

5 6

output:

Yes

result:

ok answer is YES

Test #35:

score: 0
Accepted
time: 0ms
memory: 3492kb

input:

6 0

output:

Yes

result:

ok answer is YES

Test #36:

score: 0
Accepted
time: 0ms
memory: 3340kb

input:

8 0

output:

No

result:

ok answer is NO

Test #37:

score: 0
Accepted
time: 0ms
memory: 3384kb

input:

8 1

output:

No

result:

ok answer is NO

Test #38:

score: 0
Accepted
time: 0ms
memory: 3308kb

input:

8 2

output:

Yes

result:

ok answer is YES

Test #39:

score: 0
Accepted
time: 0ms
memory: 3256kb

input:

8 3

output:

Yes

result:

ok answer is YES

Test #40:

score: 0
Accepted
time: 1ms
memory: 3308kb

input:

5 5

output:

Yes

result:

ok answer is YES

Test #41:

score: 0
Accepted
time: 0ms
memory: 3416kb

input:

100 100

output:

No

result:

ok answer is NO

Test #42:

score: 0
Accepted
time: 0ms
memory: 3312kb

input:

0 100

output:

No

result:

ok answer is NO

Test #43:

score: 0
Accepted
time: 0ms
memory: 3344kb

input:

100 0

output:

No

result:

ok answer is NO

Test #44:

score: 0
Accepted
time: 1ms
memory: 3312kb

input:

15 23

output:

No

result:

ok answer is NO

Test #45:

score: 0
Accepted
time: 0ms
memory: 3312kb

input:

46 53

output:

No

result:

ok answer is NO

Test #46:

score: 0
Accepted
time: 0ms
memory: 3416kb

input:

9 0

output:

Yes

result:

ok answer is YES

Test #47:

score: 0
Accepted
time: 0ms
memory: 3372kb

input:

2 5

output:

Yes

result:

ok answer is YES