正文
增加 5 行删除 5 行
59 行未改动6061626364656667686970717277 行未改动15015115215315415515615715837 行未改动19619719819920020120220320414 行未改动21922022122222322422522622722859 行未改动a[r][c] = 1;for(int i=2; i <= n*n; i++){if(!a[(r - 1 + n) % n][(c + 1) % n])r = (r - 1 + n) % n,c = (c + 1) % n,a[r][c] = i;elser = (r + 1) % n,a[r][c] = i;}77 行未改动ans ++;}}cout << ans;return 0;}```37 行未改动for(int i=1; i<=h; i++)for(int j=1; j<=w; j++){cin >> s[i][j];if(s[i][j] != '#' && s[i][j] != '.')siu[s[i][j] - 'a'].push_back({i, j, 0});}queue<Edge> q; int ans = 0;14 行未改动int dx = t.x + r[i][0];int dy = t.y + r[i][1];if(vis[dx][dy] == 0 && dx >= 1 && dx <= h && dy >= 1 && dy <= w && s[dx][dy] != '#')q.push({dx, dy, t.st + 1}), vis[dx][dy] = 1;}}cout << (ans ? ans : -1) << endl;return 0;}```59 行未改动6061626364656667686970717277 行未改动15015115215315415515615715837 行未改动19619719819920020120220320414 行未改动21922022122222322422522622722859 行未改动a[r][c] = 1;for(int i=2; i <= n*n; i++){if(!a[(r - 1 + n) % n][(c + 1) % n])r = (r - 1 + n) % n,c = (c + 1) % n,a[r][c] = i;elser = (r + 1) % n,a[r][c] = i;}77 行未改动ans ++;}}cout << ans;return 0;}```37 行未改动for(int i=1; i<=h; i++)for(int j=1; j<=w; j++){cin >> s[i][j];if(s[i][j] != '#' && s[i][j] != '.')siu[s[i][j] - 'a'].push_back({i, j, 0});}queue<Edge> q; int ans = 0;14 行未改动int dx = t.x + r[i][0];int dy = t.y + r[i][1];if(vis[dx][dy] == 0 && dx >= 1 && dx <= h && dy >= 1 && dy <= w && s[dx][dy] != '#')q.push({dx, dy, t.st + 1}), vis[dx][dy] = 1;}}cout << (ans ? ans : -1) << endl;return 0;}```