QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#623194#5731. CheckerboardoschlimgenWA 0ms3612kbC++201.6kb2024-10-09 10:32:492024-10-09 10:32:50

Judging History

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

  • [2024-10-09 10:32:50]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3612kb
  • [2024-10-09 10:32:49]
  • 提交

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: ''