Codeforce 1105 D. Kilani and the Game 解析(裸BFS.實作) 今天我們來看看CF1105D 題目連結 題目 給一個\(n\times m\)的地圖,地圖上有幾種格子:空地.路障.某個玩家的某些城堡.(可能有\(1\le p\le9\)個玩家) 給定一開始每個玩家至少有一個城堡,玩家照順序移動,每個玩家有自己的移動步數,求最後每個玩家能有幾個城堡. 前言 寫這題一直TLE,搞了好幾個小時才發現如果每次BFS都宣告一個新的queue,那麼可能會因為allocat…
坑爹题,两种输入输出互相交换,裸bfs #include <stdio.h> #include <string.h> typedef struct { int x; int y; } point; point q[310]; int vis[15][15],mat[15][15]; int dx[4]= {1,0,-1,0}; int dy[4]= {0,1,0,-1}; char ans[5]= {"RTLB"}; int bfs1(int x,int y)…