Submission #162817


Source Code Expand

using System;

class ABC007C
{
  static int Main(string[] args)
  {
    string[] rc = Console.ReadLine().Split();
    int R = int.Parse(rc[0]);
    int C = int.Parse(rc[1]);
    string[] sysx = Console.ReadLine().Split();
    int sy = int.Parse(sysx[0]);
    int sx = int.Parse(sysx[1]);
    string[] gygx = Console.ReadLine().Split();
    int gy = int.Parse(gygx[0]);
    int gx = int.Parse(gygx[1]);
    string[][] c = new string[R][];
    for(int i = 0; i < R; i++){
      string[] raw = Console.ReadLine().Split();
      c[i] = raw;
    }

    string empty = ".";
    string wall = "#";
    int[,] cost = new int[R, C];
    for(int i = 0; i < R; i++){
      for(int j = 0; j < C; j++){
        if(c[i][j] == wall)
          cost[i, j] = -1;
      }
    }
    int[] qy = new int[]{sy};
    int[] qx = new int[]{sx};

    for(int next_cost = 0; next_cost <= (R - 2) * (C - 2); next_cost++){
      for(int q = 0; q < qy.Length; q++){
        int y = qy.Pop();
        int x = qx.Pop();
        if(cost[y - 1, x] == 0){
          cost[y - 1, x] = i + 1;
          qy.append(y - 1);
          qx.append(x);
        }
        if(cost[y, x - 1] == 0){
          cost[y, x - 1] = i + 1;
          qy.append(y);
          qx.append(x - 1);
        }
        if(cost[y + 1, x] == 0){
          cost[y + 1, x] = i + 1;
          qy.append(y + 1);
          qx.append(x);
        }
        if(cost[y, x + 1] == 0){
          cost[y, x + 1] = i + 1;
          qy.append(y);
          qx.append(x + 1);
        }
      }
    }
    int goal_cost = cost[gy, gx];
    Console.WriteLine(goal_cost);

    return 0;
  }
}

Submission Info

Submission Time
Task C - 幅優先探索
User kutsutama
Language C# (Mono 2.10.8.1)
Score 0
Code Size 1671 Byte
Status CE

Compile Error

./Main.cs(36,20): error CS1061: Type `int[]' does not contain a definition for `Pop' and no extension method `Pop' of type `int[]' could be found (are you missing a using directive or an assembly reference?)
/usr/lib/mono/4.0/mscorlib.dll (Location of the symbol related to previous error)
./Main.cs(37,20): error CS1061: Type `int[]' does not contain a definition for `Pop' and no extension method `Pop' of type `int[]' could be found (are you missing a using directive or an assembly reference?)
/usr/lib/mono/4.0/mscorlib.dll (Location of the symbol related to previous error)
./Main.cs(39,28): error CS0103: The name `i' does not exist in the current context
./Main.cs(40,14): error CS1061: Type `int[]' does not contain a definition for `append' and no extension method `append' of type `int[]' could be found (are you missing a using directive or an assembly reference?)
/usr/lib/mono/4.0/mscorlib.dll (Location of the symbol related to previous error)
./Main.cs(41,14): error CS1061: Type `int[]' does not contain a d...