QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#626388 | #5731. Checkerboard | Rebuked | WA | 0ms | 3476kb | C++20 | 1.3kb | 2024-10-10 07:43:33 | 2024-10-10 07:43:34 |
Judging History
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 == 0) 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;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3476kb
input:
6 5 3 2 1 2 3 3 2
output:
BBBWW BBBWW WWWBB WWWBB BBBWW WWWBB
result:
wrong answer 2nd lines differ - expected: 'WWWBB', found: 'BBBWW'