QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#623194 | #5731. Checkerboard | oschlimgen | WA | 0ms | 3612kb | C++20 | 1.6kb | 2024-10-09 10:32:49 | 2024-10-09 10:32:50 |
Judging History
answer
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <fstream>
class inputParams {
public:
int rows;
int cols;
int wideRows;
int wideCols;
std::vector<int> rowSizes;
std::vector<int> colSizes;
inputParams() {
read();
}
void read() {
std::string line;
std::getline(std::cin, line);
rows = line.at(0) - '0';
cols = line.at(2) - '0';
wideRows = line.at(4) - '0';
wideCols = line.at(6) - '0';
for(int i = 0; i < wideRows; ++i) {
std::getline(std::cin, line);
rowSizes.push_back(line.at(0) - '0');
}
for(int i = 0; i < wideCols; ++i) {
std::getline(std::cin, line);
colSizes.push_back(line.at(0) - '0');
}
}
};
std::string printChecker(const std::vector<int>& rows, const std::vector<int>& cols) {
bool rowStartColor = true;
bool checkerColor = true;
std::string output;
for(int ri = 0; ri < rows.size(); ++ri) {
for(int rj = 0; rj < rows.at(ri); ++rj) {
std::string line;
checkerColor = rowStartColor;
for(int ci = 0; ci < cols.size(); ++ci) {
for(int cj = 0; cj < cols.at(ci); ++cj) {
if(checkerColor) {
line += "B";
} else {
line += "W";
}
}
checkerColor = !checkerColor;
}
output += line + "\n";
}
rowStartColor = !rowStartColor;
}
return output;
}
int main() {
inputParams input;
std::string output;
output = printChecker(input.rowSizes, input.colSizes);
std::cout << output;
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3548kb
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: 3612kb
input:
4 4 2 2 1 3 3 1
output:
BBBW WWWB WWWB WWWB
result:
ok 4 lines
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3600kb
input:
20 20 4 14 5 2 9 4 1 2 1 1 1 1 1 1 1 1 1 1 4 3
output:
result:
wrong answer 1st lines differ - expected: 'BWWBWBWBWBWBWBBBBWWW', found: ''