QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#241729#7145. Chessboard game8BQube#RE 819ms15900kbC++201.3kb2023-11-06 16:26:152023-11-06 16:26:16

Judging History

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

  • [2023-11-06 16:26:16]
  • 评测
  • 测评结果:RE
  • 用时:819ms
  • 内存:15900kb
  • [2023-11-06 16:26:15]
  • 提交

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;
        x += y;
        if (x <= kN) query[x].emplace_back(y, i);
        else query[x].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";
    }
}

详细

Test #1:

score: 100
Accepted
time: 768ms
memory: 13280kb

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: 13240kb

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: 760ms
memory: 12988kb

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: 753ms
memory: 13556kb

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: 756ms
memory: 13516kb

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: 765ms
memory: 13364kb

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: 758ms
memory: 12984kb

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: 758ms
memory: 13460kb

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: 764ms
memory: 13268kb

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: 762ms
memory: 13284kb

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: 759ms
memory: 12976kb

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: 786ms
memory: 15304kb

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: 774ms
memory: 15900kb

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: 784ms
memory: 15616kb

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: 776ms
memory: 15308kb

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: 790ms
memory: 15616kb

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: 15728kb

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: 784ms
memory: 15880kb

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: 819ms
memory: 15532kb

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: 777ms
memory: 15704kb

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: 785ms
memory: 15588kb

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: -100
Runtime Error

input:

150609 103318 200000
110010110000001001011100111001010001011101101001101110010101010111001001001001001011110000011010001100011110100110000110011110101111101011101101010011111011101001110101111001000001110100010001001011011110101011101010011000111010010110011111011010000000110000010101110000111101100...

output:


result: