QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#626387 | #5731. Checkerboard | Rebuked | WA | 0ms | 3808kb | C++20 | 1.2kb | 2024-10-10 07:43:19 | 2024-10-10 07:43:19 |
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];
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: 100
Accepted
time: 0ms
memory: 3516kb
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: 3580kb
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: 3624kb
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: 3580kb
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: 3772kb
input:
1 50 1 5 1 1 10 11 22 6
output:
BWWWWWWWWWWBBBBBBBBBBBWWWWWWWWWWWWWWWWWWWWWWBBBBBB
result:
ok single line: 'BWWWWWWWWWWBBBBBBBBBBBWWWWWWWWWWWWWWWWWWWWWWBBBBBB'
Test #6:
score: -100
Wrong Answer
time: 0ms
memory: 3808kb
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 W B W W W W W B W B W B B W W B W W W B W W B W B W W W B W B B W B W B B B W B W B W W B B W B W
result:
wrong answer 2nd lines differ - expected: 'B', found: 'W'