QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#219579 | #7145. Chessboard game | ckiseki# | AC ✓ | 301ms | 45680kb | C++20 | 1.5kb | 2023-10-19 16:26:38 | 2023-10-19 16:26:38 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define all(x) begin(x), end(x)
#ifdef CKISEKI
#define safe cerr << __PRETTY_FUNCTION__ << " line " << __LINE__ << " safe\n"
#define debug(a...) debug_(#a, a)
#define orange(a...) orange_(#a, a)
void debug_(const char *s, auto ...a) {
cerr << "\e[1;32m(" << s << ") = (";
int f = 0;
(..., (cerr << (f++ ? ", " : "") << a));
cerr << ")\e[0m\n";
}
void orange_(const char *s, auto L, auto R) {
cerr << "\e[1;33m[ " << s << " ] = [ ";
for (int f = 0; L != R; ++f)
cerr << (f ? ", " : "") << *L++;
cerr << " ]\e[0m\n";
}
#else
#define safe ((void)0)
#define orange(...) safe
#define debug(...) safe
#endif
// const int maxn = 20;
// int a[maxn][maxn];
const int maxn = 200025;
map<pair<int,int>, int> mp;
int r[maxn], c[maxn];
int DP(int a, int b) {
debug(a, b, r[b], c[a]);
if (a == 0)
return c[b];
if (b == 0)
return r[a];
if (auto it = mp.find({a, b}); it != mp.end())
return it->second;
int ans = !(DP(a - 1, b) && DP(a, b - 1));
return mp[{a, b}] = ans;
}
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
// mt19937 rng(92130);
int n, m, q;
cin >> n >> m >> q;
{
string s;
cin >> s;
for (int i = 1; i <= n; i++) {
r[i] = s[i - 1] - '0';
}
}
{
string s;
cin >> s;
for (int i = 1; i <= m; i++) {
c[i] = s[i - 1] - '0';
}
}
while (q--) {
int x, y;
cin >> x >> y;
int z = max(0, min(x, y) - 2);
debug(x - z, y - z);
int ans = DP(x - z, y - z);
cout << (ans ? "Yes\n" : "No\n");
}
}
这程序好像有点Bug,我给组数据试试?
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3484kb
input:
2 2 4 10 11 1 1 1 2 2 1 2 2
output:
No Yes Yes No
result:
ok 4 lines
Test #2:
score: 0
Accepted
time: 0ms
memory: 3432kb
input:
5 4 10 00001 0100 3 1 1 3 2 2 1 1 3 1 2 2 3 4 3 2 5 1 3 4
output:
Yes Yes Yes Yes Yes Yes No No No No
result:
ok 10 lines
Test #3:
score: 0
Accepted
time: 0ms
memory: 3488kb
input:
4 5 10 1011 01000 3 1 3 1 2 3 2 5 2 2 1 5 1 1 2 5 2 4 3 2
output:
No No No No Yes Yes Yes No Yes Yes
result:
ok 10 lines
Test #4:
score: 0
Accepted
time: 1ms
memory: 3480kb
input:
3 4 10 000 1110 3 2 1 1 2 1 3 1 2 1 1 1 1 2 1 3 1 4 2 4
output:
No Yes Yes Yes Yes Yes No Yes Yes Yes
result:
ok 10 lines
Test #5:
score: 0
Accepted
time: 0ms
memory: 3516kb
input:
5 4 10 01011 1001 1 4 3 3 3 1 1 4 1 3 4 3 3 2 3 3 4 4 2 3
output:
No Yes Yes No Yes No No Yes Yes No
result:
ok 10 lines
Test #6:
score: 0
Accepted
time: 0ms
memory: 3456kb
input:
3 5 10 111 11100 3 2 1 4 3 3 1 2 2 4 3 2 2 1 2 4 3 2 1 3
output:
Yes Yes No Yes No Yes Yes No Yes No
result:
ok 10 lines
Test #7:
score: 0
Accepted
time: 0ms
memory: 3512kb
input:
5 2 10 01011 11 4 1 5 2 1 2 5 2 5 1 1 1 3 2 2 2 2 1 1 1
output:
No No No No Yes Yes No Yes No Yes
result:
ok 10 lines
Test #8:
score: 0
Accepted
time: 1ms
memory: 3444kb
input:
5 4 10 01101 1101 2 3 4 2 2 4 4 3 4 1 2 1 4 3 2 4 5 3 3 2
output:
No Yes Yes No Yes No No Yes Yes No
result:
ok 10 lines
Test #9:
score: 0
Accepted
time: 1ms
memory: 3432kb
input:
4 4 10 1101 1110 1 2 3 2 2 1 1 1 3 2 3 2 1 2 4 4 1 3 2 3
output:
Yes Yes Yes No Yes Yes Yes No No Yes
result:
ok 10 lines
Test #10:
score: 0
Accepted
time: 1ms
memory: 3448kb
input:
5 5 10 00101 01001 5 5 4 4 1 4 2 3 3 5 5 3 3 3 5 5 2 1 5 1
output:
Yes Yes Yes No Yes No Yes Yes Yes No
result:
ok 10 lines
Test #11:
score: 0
Accepted
time: 1ms
memory: 3484kb
input:
5 5 10 00010 10111 3 1 4 2 5 5 4 2 4 1 3 4 5 5 4 1 5 3 1 4
output:
Yes Yes No Yes No Yes No No Yes Yes
result:
ok 10 lines
Test #12:
score: 0
Accepted
time: 28ms
memory: 3644kb
input:
932 425 200000 011110011110110001111000011101000101100111100111000110101110010111010101000000011000001101101000110101110111101101101000000001010110011101111111101000110111101001001000000100100100110111101010001010111000000101101101100001011110111101110010011011010100110011001110111100011101010101111...
output:
Yes Yes Yes Yes Yes Yes No No No Yes Yes No No Yes Yes Yes No No No Yes No Yes No Yes Yes Yes Yes No No No Yes Yes Yes Yes Yes No No No Yes No Yes No Yes No Yes No Yes No Yes No No Yes Yes Yes No No No No Yes Yes Yes No No Yes Yes Yes Yes Yes No No No Yes Yes No Yes No Yes No No No No Yes Yes Yes Ye...
result:
ok 200000 lines
Test #13:
score: 0
Accepted
time: 32ms
memory: 3736kb
input:
922 879 200000 010110110001010110010111000110101001010001111000000001000100011001100100000000101111010010111110010000100001110001111011110101010110110111010011000001100001000001101100011101000110100100101111100011101011101100000101100010101011110110100010111111000110101011111100001111111101111000010...
output:
Yes Yes Yes Yes No Yes Yes Yes Yes No No No Yes Yes No No No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No No Yes Yes No No No Yes Yes Yes Yes Yes No No Yes Yes No No No Yes Yes Yes Yes Yes No Yes No No No No Yes Yes No Yes Yes No No Yes Yes No No Yes Yes Yes No No Yes No Yes No Yes Yes...
result:
ok 200000 lines
Test #14:
score: 0
Accepted
time: 28ms
memory: 3732kb
input:
726 777 200000 010101110100100110011011000010000111011011101101100001101010100100101000111010101001101101010100110011110111110000000000110001101011011101000010010111100110001001110111011000110101010000001010001101011000001010011010101111100011010100011101101110010001101111101101010100010101100011011...
output:
Yes No Yes Yes Yes Yes No No Yes Yes No Yes Yes Yes No Yes Yes Yes No No Yes Yes Yes Yes Yes Yes Yes No No Yes No No Yes Yes Yes Yes No Yes No Yes No Yes Yes Yes Yes No Yes Yes Yes Yes No No Yes Yes No No No No Yes Yes Yes Yes No No No Yes No Yes Yes Yes Yes No No No Yes Yes Yes Yes Yes No Yes Yes N...
result:
ok 200000 lines
Test #15:
score: 0
Accepted
time: 32ms
memory: 3732kb
input:
972 298 200000 111111011000000001110110110011100111100101101011001110000010111001110001111100001101100010111110110111100010011100001000110000000010010001111110011111110101111010010101010001100100010011011101100000101011000011111011010010110111011111100100011010100011001111001111100101010101100110011...
output:
Yes Yes No Yes Yes No No Yes Yes No No Yes Yes No No No Yes Yes No Yes No Yes No No No No Yes Yes Yes No No Yes Yes Yes Yes No No Yes No Yes No Yes No Yes No Yes Yes Yes Yes No No Yes Yes Yes No No Yes No Yes No Yes No Yes Yes No Yes Yes No No Yes No Yes Yes Yes Yes Yes Yes Yes No Yes Yes No Yes Yes...
result:
ok 200000 lines
Test #16:
score: 0
Accepted
time: 31ms
memory: 3656kb
input:
687 832 200000 111100000111100100011111100111001011011010111100101111101000000110111000101110111010011101010111010000110100000111011011100100000110111011011011000101000011110110110000110110010111100111111001111110111101111100110010010010111100010100001010111100110101000011110101110010111011111000110...
output:
No No Yes No No Yes No No Yes No No No No Yes No Yes Yes No Yes No Yes No No Yes Yes No Yes Yes Yes No Yes Yes Yes No Yes Yes No Yes Yes No Yes Yes Yes Yes Yes Yes Yes No Yes No No No No Yes No No Yes Yes No Yes No Yes No Yes Yes No No Yes No Yes No No Yes Yes No Yes No Yes No No No Yes Yes No Yes N...
result:
ok 200000 lines
Test #17:
score: 0
Accepted
time: 32ms
memory: 3772kb
input:
989 775 200000 110010100010010001111011001101110101001110000000101000010010001010101101100101111100100111101001110100101010101010110000100000111111110001101110000010000100011110011010101110110010111001110100010001001110011101001111001101101000111010111001001100101110000001000100010001011010111011111...
output:
Yes Yes Yes No No No No Yes No No Yes No Yes Yes Yes No Yes Yes No No Yes Yes Yes No Yes No No No Yes Yes Yes No Yes Yes No No No Yes Yes Yes No Yes Yes Yes No No Yes No Yes No No Yes No No Yes Yes Yes No Yes No No No Yes Yes Yes No No No Yes No No Yes Yes Yes No No No Yes Yes No Yes No Yes Yes Yes ...
result:
ok 200000 lines
Test #18:
score: 0
Accepted
time: 32ms
memory: 3684kb
input:
849 898 200000 111010101111110110010110011000010101100000000111001001111001110001100101100111001010101000000011100101111000101010101011100001010001011111110110111010010011010111011011100111000001001000110001111101110111110001001100001000100000110001000100111000111000101101010110001010110010100110110...
output:
Yes No No Yes Yes Yes Yes No Yes No Yes No No Yes Yes Yes Yes No No Yes No No No No No Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes No No No No Yes Yes Yes Yes No Yes Yes No Yes No No Yes Yes Yes Yes No No No No Yes Yes No Yes Yes No No Yes Yes No Yes No No Yes Yes Yes No No Yes No No No Yes Yes Y...
result:
ok 200000 lines
Test #19:
score: 0
Accepted
time: 28ms
memory: 3776kb
input:
715 831 200000 111001110010010011111000101000111000011110010001100100111111101100111110110101101101010111101000000010001100010111111000110101010000111110010011110000000001010001100101100010010010011110010101010010100100110110000101010001010101011010101011011100101110101001100101111011010010111101010...
output:
No Yes No Yes Yes Yes Yes No No Yes No No Yes No Yes Yes Yes Yes Yes No Yes No Yes No Yes Yes No No Yes No Yes Yes No Yes Yes Yes Yes Yes Yes No Yes Yes No Yes No No No Yes Yes No No No Yes Yes No No Yes No Yes Yes Yes Yes No Yes Yes Yes No Yes No Yes No Yes No Yes No Yes Yes No No Yes No No Yes No ...
result:
ok 200000 lines
Test #20:
score: 0
Accepted
time: 33ms
memory: 3720kb
input:
919 965 200000 010011010101100100010001101101111000100000000000000011010111000001111111011001111011111000001110100110011010011111010000110001101100110000101111100000010110111001000100101011100011101011000110111110010111011111100000010100011111010000010001100100111101100001010001101000111010011000011...
output:
Yes No No No Yes Yes Yes No Yes No No Yes No Yes No No No Yes Yes No No No Yes No No Yes No Yes Yes No No No Yes Yes No No Yes No No No No Yes Yes No Yes No Yes Yes No Yes No No Yes Yes Yes Yes No Yes Yes Yes Yes Yes No Yes Yes Yes Yes No No Yes Yes No No Yes No Yes Yes No Yes No Yes Yes No No Yes N...
result:
ok 200000 lines
Test #21:
score: 0
Accepted
time: 28ms
memory: 3808kb
input:
928 791 200000 000000100001100001010100011100001110010001010110111010010110010010010010101101101111010111110100101101010111010111111000000000011110101000000111101000110100001001011001010101001000110111111110110001111011110101100110100010010101101100011100010010110011000101111001011011000111110000011...
output:
Yes Yes No No No No No Yes Yes Yes Yes Yes Yes No Yes Yes No No No Yes Yes Yes No No Yes No Yes No No No Yes No Yes Yes Yes No No Yes Yes No No Yes No Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes No Yes No No No Yes Yes Yes Yes No No Yes Yes Yes No Yes No No No Yes Yes No No No ...
result:
ok 200000 lines
Test #22:
score: 0
Accepted
time: 248ms
memory: 35128kb
input:
150609 103318 200000 110010110000001001011100111001010001011101101001101110010101010111001001001001001011110000011010001100011110100110000110011110101111101011101101010011111011101001110101111001000001110100010001001011011110101011101010011000111010010110011111011010000000110000010101110000111101100...
output:
No Yes Yes No No No No No Yes Yes No No Yes Yes Yes No Yes Yes No Yes Yes No Yes No Yes Yes Yes No No Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes Yes Yes No Yes Yes No No No No No No No Yes Yes Yes No Yes Yes Yes Yes Yes No No No Yes Yes No No Yes Yes Yes Yes No Yes No No No No No No Yes No No Yes Ye...
result:
ok 200000 lines
Test #23:
score: 0
Accepted
time: 301ms
memory: 45680kb
input:
136143 181056 200000 011110000111010111101001101111001000100100110111110010101000100000101100000011010101011110010010010001000110100000101100001100111101010001101010110111100011001001011101101010000110101110000110101100011001111111011111101110011000111000100000001011001100100011011100111110011100011...
output:
Yes No No Yes No No Yes Yes Yes No Yes Yes No No Yes Yes Yes Yes Yes No No Yes Yes No Yes Yes No Yes No No Yes No Yes Yes Yes No Yes Yes No Yes Yes No Yes No No Yes Yes No Yes Yes Yes Yes No No Yes Yes Yes Yes No Yes No Yes No Yes No Yes Yes No Yes No Yes No Yes Yes Yes Yes Yes Yes Yes No Yes Yes No...
result:
ok 200000 lines
Test #24:
score: 0
Accepted
time: 247ms
memory: 35548kb
input:
136546 125548 200000 110101111001000000101011101101101011011100101101110100001010001000001000101010001110100100101101000000011101010001000001001010011001110110111110001100101101111111010001001101011011101010010100010101010101010001010011111011000100010011000011001010010110101010111111000000011100010...
output:
No Yes No Yes Yes Yes Yes Yes Yes No Yes No Yes Yes Yes Yes Yes Yes No No No No Yes No No Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes No No Yes No Yes No Yes Yes Yes No No Yes No No Yes No No No Yes No No Yes No Yes No No No Yes No No Yes Yes Yes No Yes No Yes Yes Yes Yes No Yes Yes Yes No Yes No...
result:
ok 200000 lines
Test #25:
score: 0
Accepted
time: 232ms
memory: 32956kb
input:
129545 70039 200000 1000011011100111100111101110110110011000010110110000101000111111010111111000000101110110100011110101010010011101010101010110110010110111110011110011010100011101010000100110010100101100100000001000100110110001011101110101111001101111101111010100110011100110011100100001101110011000...
output:
No Yes No No Yes Yes No No Yes Yes No No No Yes Yes Yes No Yes Yes Yes Yes Yes No No Yes Yes No Yes Yes Yes Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes No Yes No No No No Yes Yes Yes No No No No Yes No Yes No Yes Yes Yes No No No Yes No No Yes Yes Yes No Yes Yes Yes Yes Yes No Yes No No No No Yes No ...
result:
ok 200000 lines
Test #26:
score: 0
Accepted
time: 240ms
memory: 37172kb
input:
186946 46462 200000 0010110111000010101011010000000000101100100001110011010010100000011111111010110010011001011001110110001100110001101110010010011011110001010110111001000010110101011011101111100101011001011101100110010101011111001100100000101101100100001000000000000000110010101110000011001110000111...
output:
No Yes Yes No Yes Yes Yes No No No Yes Yes No Yes No Yes Yes Yes Yes Yes No Yes Yes No No Yes Yes Yes Yes Yes Yes No No No No Yes Yes Yes No No Yes Yes No No Yes Yes Yes No No Yes No No Yes Yes Yes Yes Yes No No No Yes No No No No No No Yes Yes No No No No Yes Yes No Yes Yes Yes No Yes No Yes No No ...
result:
ok 200000 lines
Test #27:
score: 0
Accepted
time: 277ms
memory: 39984kb
input:
117750 174072 200000 000011101000011100011001000100100011001011011101011011100000110100011011111111011010011011011001001001101010000011010100001111010101101110111010011000010111100010101110011001011001101101100100101100011011011010000000110110010000111011000011000001011001101001111101000010011000011...
output:
Yes Yes Yes Yes Yes Yes Yes No No No No Yes Yes No No No Yes Yes Yes No No No Yes Yes Yes Yes Yes Yes Yes Yes No No Yes No Yes No No No Yes Yes Yes No Yes No No Yes No Yes Yes No Yes Yes Yes No Yes No No No Yes Yes Yes Yes No Yes Yes Yes No No No No No Yes No Yes No Yes No Yes No Yes Yes Yes Yes Yes...
result:
ok 200000 lines
Test #28:
score: 0
Accepted
time: 251ms
memory: 40356kb
input:
164906 103514 200000 101110110111010010010110010110010100100011001011000101011001001100011110010100000010110111110011010100101010100111011100011110010011011101101110111011011001000000010010000110010110011101111011010111010010001110100101000101001000110100111101010000110101110000010110101110001011100...
output:
No No Yes Yes Yes No Yes No Yes No No Yes No Yes No Yes No Yes No No No Yes Yes Yes No No No Yes No No No Yes No Yes Yes No No Yes No No Yes Yes No No Yes Yes No Yes Yes Yes No No No Yes No Yes No No Yes Yes Yes Yes Yes Yes No No Yes Yes Yes No Yes Yes Yes Yes No Yes Yes Yes Yes Yes No Yes No No No ...
result:
ok 200000 lines
Test #29:
score: 0
Accepted
time: 275ms
memory: 39328kb
input:
134248 145644 200000 010100000001000000100111010100010110011110110001100011111010111001101010011110011101001001011001000001110000010110110001101100100011110101111001110010000001101010010011100010100011010011101101100000011100100001101001000001101000001011010010100001101101010011011111101000101011001...
output:
Yes No No No Yes Yes Yes No No No Yes Yes No Yes Yes No Yes Yes Yes Yes No No Yes No No No No Yes No Yes Yes Yes No Yes No Yes Yes No Yes Yes Yes No No Yes Yes Yes No No Yes Yes No No No No Yes Yes No Yes No Yes Yes No No Yes Yes Yes Yes Yes No No No No No Yes Yes No Yes Yes No No No No No Yes No Ye...
result:
ok 200000 lines
Test #30:
score: 0
Accepted
time: 296ms
memory: 43460kb
input:
142867 192498 200000 010000110110011110010001101010101111000111111111111101110011001101000011010110000100110110011100101000101000010000010101101010100101011110001001000010011100111110011111100001101100000011111001011001010010110001011100111100111110100101100100101000100101000000010001100110100010011...
output:
No No Yes Yes No No Yes No Yes Yes Yes No No No No Yes Yes Yes No No No Yes Yes Yes No Yes Yes No No Yes Yes No No Yes No No No No No No No No Yes Yes Yes No Yes No Yes No Yes Yes Yes Yes No No No Yes No Yes No No Yes No Yes No Yes No Yes No No Yes No No Yes No Yes No Yes Yes Yes No Yes No Yes Yes Y...
result:
ok 200000 lines
Test #31:
score: 0
Accepted
time: 276ms
memory: 39488kb
input:
160208 129394 200000 001000001100001010010000100101010110110010100111010001110011011011011111011100010000111111100110101100011111001110010010011111001100001100001000111001110101011011101001111001000000110101000011100101100000011000000011000100001101011011110110110000001001000110011101101101001110111...
output:
No No No No Yes No Yes No No Yes No Yes No Yes Yes Yes No Yes No No No No No Yes Yes Yes No Yes No Yes Yes No No No No Yes Yes Yes Yes Yes Yes No Yes No Yes Yes Yes No Yes No Yes No Yes Yes No Yes Yes Yes Yes No Yes No Yes Yes No Yes Yes No Yes No No No No Yes No Yes No Yes No Yes No Yes Yes Yes No ...
result:
ok 200000 lines
Extra Test:
score: 0
Extra Test Passed