QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#626395#5731. CheckerboardRebukedAC ✓0ms3832kbC++201.3kb2024-10-10 07:50:582024-10-10 07:50:59

Judging History

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

  • [2024-10-10 07:50:59]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:3832kb
  • [2024-10-10 07:50:58]
  • 提交

answer

// Online C++ compiler to run C++ program online
#include <iostream>
#include <vector>
#include <map>

using namespace std;

int main() {
    int R,C,A,B;
    cin >> R >> C >> A >> B;
    vector<int> a(R);
    vector<int> b(C);
    vector<vector<char>> ans(R, vector<char> (C));
    for(int i = 0; i < A; ++i) cin >> a[i];
    for(int i = 0; i < B; ++i) cin >> b[i];
    bool x = false;
    int AC = 0;
    int BC = 0;
    int HORZ = b[BC];
    int VERT = a[AC];
    for(int i = 0; i < R; ++i) {
        if(VERT == 0) {
            x = !x;
            ++AC;
            VERT = a[AC];
        }
        bool state = x;
        for(int j = 0; j < C; ++j) {
            if(HORZ == 0) {
                x = !x;
                ++BC;
                HORZ = b[BC];
            }
            --HORZ;
            if(!x) {
                ans[i][j] = 'B';
            }
            if(x) {
                ans[i][j] = 'W';
            }
            
            if(j == C-1)  {
                BC = 0;
                HORZ = b[BC];
                if(x!= state) x = !x;
            }
        }
        --VERT;
    }
    for(int i = 0; i < R; ++i) {
        for(int j = 0; j < C; ++j) {
            cout << ans[i][j];
        }
        cout << endl;
    }

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3600kb

input:

6 5 3 2
1
2
3
3
2

output:

BBBWW
WWWBB
WWWBB
BBBWW
BBBWW
BBBWW

result:

ok 6 lines

Test #2:

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

input:

4 4 2 2
1
3
3
1

output:

BBBW
WWWB
WWWB
WWWB

result:

ok 4 lines

Test #3:

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

input:

20 20 4 14
5
2
9
4
1
2
1
1
1
1
1
1
1
1
1
1
4
3

output:

BWWBWBWBWBWBWBBBBWWW
BWWBWBWBWBWBWBBBBWWW
BWWBWBWBWBWBWBBBBWWW
BWWBWBWBWBWBWBBBBWWW
BWWBWBWBWBWBWBBBBWWW
WBBWBWBWBWBWBWWWWBBB
WBBWBWBWBWBWBWWWWBBB
BWWBWBWBWBWBWBBBBWWW
BWWBWBWBWBWBWBBBBWWW
BWWBWBWBWBWBWBBBBWWW
BWWBWBWBWBWBWBBBBWWW
BWWBWBWBWBWBWBBBBWWW
BWWBWBWBWBWBWBBBBWWW
BWWBWBWBWBWBWBBBBWWW
BWWBWB...

result:

ok 20 lines

Test #4:

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

input:

50 2 43 2
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
3
1
2
1
1
1
1
3
1
1
1
1
1
1
1

output:

BW
WB
BW
BW
WB
BW
WB
BW
WB
BW
WB
BW
WB
BW
WB
BW
WB
BW
WB
BW
WB
BW
WB
BW
WB
BW
BW
WB
BW
WB
BW
WB
BW
BW
BW
WB
BW
BW
WB
BW
WB
BW
WB
WB
WB
BW
WB
BW
WB
BW

result:

ok 50 lines

Test #5:

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

input:

1 50 1 5
1
1
10
11
22
6

output:

BWWWWWWWWWWBBBBBBBBBBBWWWWWWWWWWWWWWWWWWWWWWBBBBBB

result:

ok single line: 'BWWWWWWWWWWBBBBBBBBBBBWWWWWWWWWWWWWWWWWWWWWWBBBBBB'

Test #6:

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

input:

50 1 17 1
4
1
1
1
6
2
3
1
3
5
1
4
5
1
6
2
4
1

output:

B
B
B
B
W
B
W
B
B
B
B
B
B
W
W
B
B
B
W
B
B
B
W
W
W
W
W
B
W
W
W
W
B
B
B
B
B
W
B
B
B
B
B
B
W
W
B
B
B
B

result:

ok 50 lines

Test #7:

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

input:

2 50 2 3
1
1
14
18
18

output:

BBBBBBBBBBBBBBWWWWWWWWWWWWWWWWWWBBBBBBBBBBBBBBBBBB
WWWWWWWWWWWWWWBBBBBBBBBBBBBBBBBBWWWWWWWWWWWWWWWWWW

result:

ok 2 lines

Test #8:

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

input:

50 50 29 44
2
1
1
1
2
1
3
1
1
2
3
3
1
1
2
1
1
3
2
3
3
1
1
2
1
3
1
1
2
1
1
1
2
1
1
2
1
1
1
2
1
1
1
1
1
1
1
1
1
2
1
1
2
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1

output:

BWBWWBWBBWBWBBWBWBWBWBWBBWBWWBWBWBWBWBWBBWBWBWBWBW
BWBWWBWBBWBWBBWBWBWBWBWBBWBWWBWBWBWBWBWBBWBWBWBWBW
WBWBBWBWWBWBWWBWBWBWBWBWWBWBBWBWBWBWBWBWWBWBWBWBWB
BWBWWBWBBWBWBBWBWBWBWBWBBWBWWBWBWBWBWBWBBWBWBWBWBW
WBWBBWBWWBWBWWBWBWBWBWBWWBWBBWBWBWBWBWBWWBWBWBWBWB
BWBWWBWBBWBWBBWBWBWBWBWBBWBWWBWBWBWBWBWBBWBWB...

result:

ok 50 lines