QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#69561#2446. Block Breakerhe_ren_shi_lyp#Compile Error//Python3999b2022-12-28 18:17:212022-12-28 18:17:25

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-12-28 18:17:25]
  • Judged
  • [2022-12-28 18:17:21]
  • Submitted

answer

#include <bits/stdc++.h>

using namespace std;

const int N = 2e3 + 50;

int dx[4] = { -1, 1, 0, 0};
int dy[4] = { 0, 0, -1, 1};

bool X[N][N], Y[N][N], vis[N][N];

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int T;
	cin >> T;
	while (T--) {
		int n, m, q, tot = 0;
		auto solve = [&](auto &self, int x, int y) -> void {
			if (vis[x][y])
				return;
			vis[x][y] = true;
			++tot;
			for (int o = 0; o < 4; ++o) {
				int nx = x + dx[o], ny = y + dy[o];
				if (1 <= nx && nx <= n && 1 <= ny && ny <= m) {
					if (dx[o]) {
						X[nx][ny] = true;
					}
					if (dy[o]) {
						Y[nx][ny] = true;
					}
					if (X[nx][ny] && Y[nx][ny]) {
						self(self, nx, ny);
					}
				}
			}
		};
		cin >> n >> m >> q;
		memset(X, 0, sizeof X);
		memset(Y, 0, sizeof Y);
		memset(vis, 0, sizeof vis);
		while (q--) {
			int x, y;
			cin >> x >> y;
			tot = 0;
			solve(solve, x, y);
			cout << tot << '\n';
		}
	}
}

Details

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