QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#218808 | #7145. Chessboard game | SolitaryDream# | AC ✓ | 128ms | 22604kb | C++17 | 1.8kb | 2023-10-18 18:46:49 | 2023-10-18 18:46:49 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
const int N = 2e5 + 10;
int n, m, q;
int f[N], ans[N];
char row[N], col[N];
vector<pii> g[N];
inline void Derive(int la, int m) {
for (int i = 1; i <= m; ++i) {
f[i] = !f[i] || !la;
la = f[i];
}
}
int main() {
scanf("%d%d%d", &n, &m, &q);
scanf("%s", col + 1);
scanf("%s", row + 1);
for (int i = 1; i <= m; ++i) {
f[i] = row[i] - '0';
}
for (int i = 1, x, y; i <= q; ++i) {
scanf("%d%d", &x, &y);
g[x].push_back({y, i});
}
set<int> st;
for (int i = 1, offset; i <= n; ++i) {
if (i <= 2) {
Derive(col[i] - '0', m);
// for (int i = 1; i <= m; ++i) printf("%d", f[i]);
// puts("");
for (auto [y, id] : g[i]) ans[id] = f[y];
if (i == 2) {
offset = 0;
for (int j = 20; j <= m; ++j) if (f[j] == 1) st.insert(j);
}
} else {
++offset;
Derive(col[i] - '0', min(20, m));
if (m >= 20 && f[20]) st.insert(20 - offset);
for (auto [y, id] : g[i]) {
if (y <= 20) ans[id] = f[y];
else ans[id] = st.count(y - offset);
}
}
}
for (int i = 1; i <= q; ++i) puts(ans[i] ? "Yes" : "No");
return 0;
}
/*
10 30 4
1100110111
111100001111000011111111111111
10 29
10 28
10 27
10 26
010111110101111101010101010101
101010101010101010101010101010
110101010101010101010101010101
101010101010101010101010101010
010101010101010101010101010101
101010101010101010101010101010
110101010101010101010101010101
011010101010101010101010101010
101101010101010101010101010101
010110101010101010101010101010
*/
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 9676kb
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: 2ms
memory: 8260kb
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: 2ms
memory: 8764kb
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: 2ms
memory: 9488kb
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: 2ms
memory: 9472kb
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: 9268kb
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: 9364kb
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: 2ms
memory: 8164kb
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: 0ms
memory: 10220kb
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: 0ms
memory: 10024kb
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: 2ms
memory: 8812kb
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: 33ms
memory: 11152kb
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: 30ms
memory: 11788kb
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: 30ms
memory: 12548kb
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: 25ms
memory: 11888kb
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: 29ms
memory: 12688kb
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: 30ms
memory: 11884kb
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: 33ms
memory: 11964kb
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: 31ms
memory: 12252kb
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: 30ms
memory: 11628kb
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: 33ms
memory: 11460kb
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: 109ms
memory: 20168kb
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: 123ms
memory: 22208kb
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: 112ms
memory: 20456kb
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: 99ms
memory: 18592kb
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: 101ms
memory: 19856kb
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: 101ms
memory: 21296kb
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: 114ms
memory: 20816kb
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: 109ms
memory: 21032kb
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: 128ms
memory: 22604kb
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: 111ms
memory: 21320kb
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