QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#626390#5731. CheckerboardRebukedWA 0ms3772kbC++201.3kb2024-10-10 07:44:472024-10-10 07:44:48

Judging History

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

  • [2024-10-10 07:44:48]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3772kb
  • [2024-10-10 07:44:47]
  • 提交

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];
        }
        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(b.size()%2 == 1) 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: 3772kb

input:

6 5 3 2
1
2
3
3
2

output:

BBBWW
WWWBB
WWWBB
BBBWW
BBBWW
BBBWW

result:

ok 6 lines

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3556kb

input:

4 4 2 2
1
3
3
1

output:

BBBW
BBBW
WWWB
BBBW

result:

wrong answer 2nd lines differ - expected: 'WWWB', found: 'BBBW'