QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#681334#5731. CheckerboardfazlavarxWA 0ms3636kbC++232.2kb2024-10-27 05:30:412024-10-27 05:30:42

Judging History

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

  • [2024-10-27 05:30:42]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3636kb
  • [2024-10-27 05:30:41]
  • 提交

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);
    }

    // R = 50, C = 1, A = 17, B = 1;
    // a_i.push_back(4);
    // a_i.push_back(1);
    // a_i.push_back(1);
    // a_i.push_back(1);
    // a_i.push_back(6);
    // a_i.push_back(2);
    // a_i.push_back(3);
    // a_i.push_back(1);
    // a_i.push_back(3);
    // a_i.push_back(5);
    // a_i.push_back(1);
    // a_i.push_back(4);
    // a_i.push_back(5);
    // a_i.push_back(1);
    // a_i.push_back(6);
    // a_i.push_back(2);
    // a_i.push_back(4);
    // a_i.push_back(1);
    // b_i.push_back(1);
    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++;
        }
        vector<int> save = b_i;
        if (b_i.front() == 1 && b_i.size() == 1){
            if(EvenOrOdd2 % 2 == 0)
                cout << "B";
            else
                cout << "W";
        }       
        else{
            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;
}

详细

Test #1:

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

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

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

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

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

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

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: -100
Wrong Answer
time: 0ms
memory: 3532kb

input:

2 50 2 3
1
1
14
18
18

output:

BBBBBBBBBBBBBBWWWWWWWWWWWWWWWWWWBBBBBBBBBBBBBBBBBB
BBBBBBBBBBBBBBWWWWWWWWWWWWWWWWWWBBBBBBBBBBBBBBBBBB

result:

wrong answer 2nd lines differ - expected: 'WWWWWWWWWWWWWWBBBBBBBBBBBBBBBBBBWWWWWWWWWWWWWWWWWW', found: 'BBBBBBBBBBBBBBWWWWWWWWWWWWWWWWWWBBBBBBBBBBBBBBBBBB'