Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Slides
- {
- class Program
- {
- static void Main(string[] args)
- {
- string firstLine = Console.ReadLine();
- string[] borders = firstLine.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
- int witdth = int.Parse(borders[0]);
- int height = int.Parse(borders[1]);
- int depth = int.Parse(borders[2]);
- List<string> cubes = new List<string>();
- string[,,] cube = new string[witdth,height,depth];
- string input = "";
- int counter = 0;
- for (int i = 0; i < height; i++)
- {
- input = Console.ReadLine();
- borders = input.Split(new string[] {" | " , "(" , ")"}, StringSplitOptions.RemoveEmptyEntries);
- for (int j = 0; j < borders.Length; j++)
- {
- cubes.Add(borders[j]);
- }
- }
- counter = 0;
- for (int heights = 0; heights < cube.GetLength(1); heights++)
- {
- for (int depths = 0; depths < cube.GetLength(2); depths++)
- {
- for (int witdths = 0; witdths < cube.GetLength(0); witdths++)
- {
- if (cubes[counter] != " ")
- {
- cube[witdths, heights, depths] = cubes[counter];
- }
- else
- {
- while (cubes[counter] == " ")
- {
- counter++;
- }
- cube[witdths, heights, depths] = cubes[counter];
- }
- counter++;
- }
- }
- }
- input = Console.ReadLine();
- int ballW = input[0] - 48;
- int ballD = input[2] - 48;
- int ballH = 0;
- int oldW = 0;
- int oldD = 0;
- int oldH = 0;
- while (true)
- {
- oldD = ballD;
- oldW = ballW;
- oldH = ballH;
- if (cube[ballW,ballH,ballD] == "S L")
- {
- ballW--;
- ballH++;
- }
- else if (cube[ballW,ballH,ballD] == "S R")
- {
- ballW++;
- ballH++;
- }
- else if (cube[ballW, ballH, ballD] == "S B")
- {
- ballD++;
- ballH++;
- }
- else if (cube[ballW, ballH, ballD] == "S FL")
- {
- ballW--;
- ballD--;
- ballH++;
- }
- else if (cube[ballW, ballH, ballD] == "S FR")
- {
- ballW++;
- ballD--;
- ballH++;
- }
- else if (cube[ballW, ballH, ballD] == "S Bl")
- {
- ballW--;
- ballD++;
- ballH++;
- }
- else if (cube[ballW, ballH, ballD] == "S BR")
- {
- ballW++;
- ballD++;
- ballH++;
- }
- else if (cube[ballW, ballH, ballD] == "E")
- {
- ballH++;
- }
- else if (cube[ballW, ballH, ballD] == "S F")
- {
- ballD--;
- ballH++;
- }
- else if (cube[ballW, ballH, ballD] == "B")
- {
- Console.WriteLine("No");
- Console.WriteLine("{0} {1} {2}", oldW, oldH, oldD);
- return;
- }
- else if (cube[ballW, ballH, ballD][0] == 'T')
- {
- borders = cube[ballW, ballH, ballD].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
- ballW = int.Parse(borders[1]);
- ballD = int.Parse(borders[2]);
- }
- if ((ballW == -1 || ballW == cube.GetLength(0)) && ballH == cube.GetLength(1))
- {
- Console.WriteLine("Yes");
- Console.WriteLine("{0} {1} {2}", oldW, oldH, oldD);
- return;
- }
- else if (ballW == -1 || ballW == cube.GetLength(0))
- {
- Console.WriteLine("No");
- Console.WriteLine("{0} {1} {2}", oldW, oldH, oldD);
- return;
- }
- if ((ballD == -1 || ballD == cube.GetLength(2)) && ballH == cube.GetLength(1))
- {
- Console.WriteLine("Yes");
- Console.WriteLine("{0} {1} {2}", oldW, oldH, oldD);
- return;
- }
- else if (ballD == -1 || ballD == cube.GetLength(2))
- {
- Console.WriteLine("No");
- Console.WriteLine("{0} {1} {2}", oldW, oldH, oldD);
- return;
- }
- if (ballH == cube.GetLength(1))
- {
- Console.WriteLine("Yes");
- Console.WriteLine("{0} {1} {2}", oldW, oldH, oldD);
- return;
- }
- }
- //for (int witdths = 0; witdths < cube.GetLength(0); witdths++)
- //{
- // for (int heights = 0; heights < cube.GetLength(1); heights++)
- // {
- // for (int depths = 0; depths < cube.GetLength(2); depths++)
- // {
- // Console.Write(cube[witdths, heights, depths] + "'");
- // }
- // Console.WriteLine();
- // }
- //}
- //for (int i = 0; i < cubes.Count; i++)
- //{
- // borders = cubes[i].Split(new char[] { '(', ')' }, StringSplitOptions.RemoveEmptyEntries);
- // foreach (var item in borders)
- // {
- // Console.Write(item);
- // }
- // Console.WriteLine();
- //}
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement