Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. const int MAXN = 75;
  6. char maze[MAXN][MAXN + 3];
  7. int vis[MAXN][MAXN][2];
  8. int C, F;
  9. int ncycles;
  10. int longest; // length of longest cycle
  11.  
  12. struct Pos {
  13. int f, c, h;
  14. };
  15.  
  16. bool connected(Pos a, Pos b) {
  17. if (a.c > b.c || a.f > b.f) {
  18. swap(a, b);
  19. }
  20. if (maze[a.c][a.f] == '/') {
  21. if (b.c == a.c + 1) {
  22. return a.h == 0 && b.h == 1;
  23. }
  24. if (b.f == a.f + 1) {
  25. return a.h == 0;
  26. }
  27. } else {
  28. if (b.c == a.c + 1) {
  29. return a.h == 0 && b.h = 1;
  30. }
  31. if (b.f == a.f + 1) {
  32. return a.h == 1 && b.h == 1;
  33. }
  34. }
  35. return false;
  36. }
  37.  
  38. bool inside(int f, int c) {
  39. return 0 <= f && f < F && 0 <= c && c < C;
  40. }
  41.  
  42. void dfs(int f, int c, int h) {
  43. for (int df = -1; df <= 1; df++) {
  44. for (int dc = -1; dc <= 1; dc++) {
  45. for (int h = 0; h < 2; h++) {
  46.  
  47. }
  48. }
  49. }
  50. }
  51.  
  52. void solve() {
  53. for (int f = 0; f < F; f++) {
  54. for (int c = 0; c < C; c++) {
  55. for (int h = 0; h < 2; h++) {
  56. if (vis[f][c][h] == 0) {
  57. dfs(f, c, h);
  58. }
  59. }
  60. }
  61. }
  62. }
  63.  
  64. int main() {
  65. while (cin >> C >> F, C != 0 && F != 0) {
  66. for (int f = 0; f < F; f++) {
  67. cin >> maze[f];
  68. }
  69. ncycles = 0;
  70. longest = 0;
  71. solve();
  72. }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement