QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#263725#5101. Crystal Crosswindjuancagp2001Compile Error//Python31.3kb2023-11-25 04:48:512023-11-25 04:48:52

Judging History

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

  • [2023-11-25 04:48:52]
  • 评测
  • [2023-11-25 04:48:51]
  • 提交

answer

#include <iostream>
#include <vector>
using namespace std;

int X, Y, N;
vector<vector<char>> g;
vector<int> wm, wn;

void doit(int x, int y) {
  char ch = (x >= 1 && x <= X && y >= 1 && y <= Y ? g[y][x] : '.');
  if (!ch) return;
  for (int i = 0; i < N; i++) {
    int x2 = x + (ch == '.' ? wm[i] : -wm[i]);
    int y2 = y + (ch == '.' ? wn[i] : -wn[i]);
    if (x2 >= 1 && x2 <= X && y2 >= 1 && y2 <= Y && !g[y2][x2]) {
      g[y2][x2] = ch;
      doit(x2, y2);
    }
  }
}

int main() {
  while (cin >> X >> Y >> N) {
    g = vector<vector<char>>(Y+1, vector<char>(X+1));
    wm = wn = vector<int>(N);
    for (int i = 0; i < N; i++) {
      int B, x, y;
      cin >> wm[i] >> wn[i] >> B;
      for (int j = 0; j < B; j++) {
        cin >> x >> y;
        g[y][x] = '#';
        int x2 = x-wm[i], y2 = y-wn[i];
        if (x2 >= 1 && x2 <= X && y2 >= 1 && y2 <= Y) g[y2][x2] = '.';
      }
    }
    for (int y = -Y; y <= 2*Y; y++) for (int x = -X; x <= 2*X; x++) doit(x, y);

    for (int y = 1; y <= Y; y++) {
      for (int x = 1; x <= X; x++) cout << (g[y][x] ? g[y][x] : '.');
      cout << endl;
    }
    cout << endl;
    for (int y = 1; y <= Y; y++) {
      for (int x = 1; x <= X; x++) cout << (g[y][x] ? g[y][x] : '#');
      cout << endl;
    }
  }
}

详细

  File "answer.code", line 3
    using namespace std;
          ^^^^^^^^^
SyntaxError: invalid syntax