QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#681341#5731. CheckerboardfazlavarxAC ✓1ms3632kbC++231.4kb2024-10-27 05:37:582024-10-27 05:37:58

Judging History

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

  • [2024-10-27 05:37:58]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3632kb
  • [2024-10-27 05:37:58]
  • 提交

answer

#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int R, C, A, B;
    cin >> R >> C >> A >> B;

    vector<int> a_i;
    vector<int> b_i;
    int X = A;
    while (X--)
    {
        int in;
        cin >> in;
        a_i.push_back(in);
    }
    X = B;
    while (X--)
    {
        int in;
        cin >> in;
        b_i.push_back(in);
    }
    int EvenOrOdd = 0;
    int EvenOrOdd2 = 0;
    for (int i = 0; i < R; i++)
    {
        if (a_i.front() == 0)
        {
            a_i.erase(a_i.begin());
            EvenOrOdd2++;
        }
        EvenOrOdd = 0;
        vector<int> save = b_i;

        while (!save.empty())
        {
            if (save.front() == 0)
            {
                save.erase(save.begin());
                EvenOrOdd++;
            }
            else if (save.front() > 0)
            {
                if (EvenOrOdd2 % 2 == 0)
                {
                    if (EvenOrOdd % 2 == 0)
                        cout << "B";
                    else
                        cout << "W";
                }
                else
                {
                    if (EvenOrOdd % 2 == 0)
                        cout << "W";
                    else
                        cout << "B";
                }

                save.front()--;
            }
        }
        cout << endl;
        a_i.front()--;
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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

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

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

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

input:

1 50 1 5
1
1
10
11
22
6

output:

BWWWWWWWWWWBBBBBBBBBBBWWWWWWWWWWWWWWWWWWWWWWBBBBBB

result:

ok single line: 'BWWWWWWWWWWBBBBBBBBBBBWWWWWWWWWWWWWWWWWWWWWWBBBBBB'

Test #6:

score: 0
Accepted
time: 1ms
memory: 3628kb

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

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

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