QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#241733 | #7145. Chessboard game | 8BQube# | AC ✓ | 834ms | 18156kb | C++20 | 1.3kb | 2023-11-06 16:29:08 | 2023-11-06 16:29:08 |
Judging History
answer
#pragma GCC optimize("O3")
#pragma GCC target("avx,avx2")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define X first
#define Y second
#define ALL(v) v.begin(), v.end()
#define pb push_back
#define SZ(a) ((int)a.size())
constexpr int kN = 200000;
bool a[kN + 1], b[kN + 1], ans[kN + 1];
bitset<kN + 1> bs;
vector<pii> query[kN * 2 + 1];
int main() {
ios::sync_with_stdio(0), cin.tie(0);
int n, m, q;
cin >> n >> m >> q;
string s, t;
cin >> s >> t;
for (int i = 0; i < n; ++i) a[i] = (s[i] == '1');
for (int i = 0; i < m; ++i) b[i] = (t[i] == '1');
for (int i = 0; i < q; ++i) {
int x, y;
cin >> x >> y;
if (x + y <= kN) query[x + y].emplace_back(y, i);
else query[x + y].emplace_back(kN - x, i);
}
for (int i = 1; i <= kN; ++i) {
bs &= bs << 1;
bs.flip();
bs[0] = a[i - 1];
bs[i] = b[i - 1];
for (const auto &q : query[i]) ans[q.second] = bs[q.first];
}
for (int i = kN + 1; i <= 2 * kN; ++i) {
bs &= bs >> 1;
bs.flip();
for (const auto &q : query[i]) ans[q.second] = bs[q.first];
}
for (int i = 0; i < q; ++i) {
if (ans[i]) cout << "Yes\n";
else cout << "No\n";
}
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 763ms
memory: 12944kb
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: 760ms
memory: 13076kb
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: 768ms
memory: 12984kb
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: 759ms
memory: 13156kb
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: 762ms
memory: 13040kb
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: 763ms
memory: 13204kb
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: 765ms
memory: 13480kb
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: 755ms
memory: 13144kb
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: 767ms
memory: 12976kb
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: 755ms
memory: 12944kb
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: 758ms
memory: 13616kb
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: 796ms
memory: 15376kb
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: 796ms
memory: 15688kb
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: 780ms
memory: 15684kb
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: 788ms
memory: 15320kb
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: 782ms
memory: 15496kb
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: 775ms
memory: 15660kb
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: 788ms
memory: 15740kb
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: 777ms
memory: 15512kb
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: 788ms
memory: 15804kb
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: 780ms
memory: 15576kb
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: 834ms
memory: 17880kb
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: 795ms
memory: 18080kb
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: 804ms
memory: 17676kb
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: 799ms
memory: 17664kb
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: 805ms
memory: 17748kb
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: 813ms
memory: 18096kb
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: 813ms
memory: 17948kb
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: 807ms
memory: 17896kb
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: 818ms
memory: 18156kb
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: 811ms
memory: 18156kb
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