CodeCraft-20 (Div. 2)
D 被样例的构造误导到了奇怪的地方,以为“无限走”就要不断经过起始格子,实际上可以走到某个“核心”处然后在核心处绕圈圈。 int n; int x[1005][1005]; int y[1005][1005]; int vis[1005][1005]; int deg[1005][1005]; char ans[1005][1005]; int dx[4] = {0, 0, 1, -1}; int dy[4] = {-1, 1, 0, 0}; char dans[4] = {'R', 'L', 'U', 'D'}; char adans[4] = {'L', 'R', 'D', 'U'}; queue<pii> Q; void bfs1(int ux, int uy) { vis[ux][uy] = 1; ans[ux][uy] = 'X'; Q.push({ux, uy}); while(!Q.empty()) { int vx = Q.front().first; int vy = Q.front().second; Q.pop(); for(int i = 0; i < 4; ++i) { int tx = vx + dx[i]; int ty = vy + dy[i]; if(1 <= tx && tx <= n && 1 <= ty && ty <= n) { if(x