Submission #34516


Source Code Expand

Copy
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Amidakuji
{
    class Program
    {
        static int[,] horizon;
        static int vCount, vLength;
        static char[] separator = new char[] { ' ' };

        static void Main(string[] args)
        {
            var split = Console.ReadLine().Split(' ');
            vCount = int.Parse(split[0]);
            vLength = int.Parse(split[1]);

            horizon = new int[vCount - 1, vLength];

            int line = vLength;
            while (line-- > 0)
            {
                var input = Console.ReadLine().Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                var h = input.Select(s =>
                {
                    if (s == " ") return 0;
                    else if (s == "-") return 1;
                    else return -1;
                });
                int i = 0;
                int count = 1 - line;
                foreach (var hh in h)
                {
                    horizon[i, count] = hh;
                    i++;
                }

            }
            int nowPosition = Console.ReadLine().IndexOf('o') / 2;
            for (int i = vLength - 1; i >= 0; i--)
            {
                if (GetHorizonBarState(nowPosition, i) == 1)
                {
                    nowPosition++;
                }
                else if (GetHorizonBarState(nowPosition - 1, i) == 1)
                {
                    nowPosition--;
                }
            }
            nowPosition++;

            Console.WriteLine(nowPosition);
        }

        private static int GetHorizonBarState(int x, int y)
        {
            if (IsOutOfRange(x, y)) return -1;
            return horizon[x, y];
        }

        private static bool IsOutOfRange(int x, int y)
        {
            return horizon == null || x < 0 || x >= vCount - 1 || y < 0 || y >= vLength;
        }
    }
}

Submission Info

Submission Time
Task B - あみだくじ
User jag5X
Language C# (Mono 2.10.8.1)
Score 0
Code Size 2056 Byte
Status RE
Exec Time 176 ms
Memory 8672 KB

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
AC × 9
RE × 25
Set Name Test Cases
All 00_min.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 00_sample_04.txt, 00_sample_05.txt, 01_rnd_00.txt, 01_rnd_01.txt, 01_rnd_02.txt, 01_rnd_03.txt, 01_rnd_04.txt, 01_rnd_05.txt, 01_rnd_06.txt, 01_rnd_07.txt, 01_rnd_08.txt, 01_rnd_09.txt, 01_rnd_10.txt, 01_rnd_11.txt, 01_rnd_12.txt, 01_rnd_13.txt, 01_rnd_14.txt, 01_rnd_15.txt, 01_rnd_16.txt, 01_rnd_17.txt, 01_rnd_18.txt, 01_rnd_19.txt, 02_maxrnd_00.txt, 02_maxrnd_01.txt, 02_maxrnd_02.txt, 02_maxrnd_03.txt, 02_maxrnd_04.txt, 03_empty_00.txt, 03_empty_01.txt, 03_empty_02.txt
Case Name Status Exec Time Memory
00_min.txt AC 148 ms 8672 KB
00_sample_01.txt AC 150 ms 8612 KB
00_sample_02.txt AC 154 ms 8672 KB
00_sample_03.txt AC 143 ms 8548 KB
00_sample_04.txt AC 147 ms 8532 KB
00_sample_05.txt RE 150 ms 8588 KB
01_rnd_00.txt RE 150 ms 8580 KB
01_rnd_01.txt RE 146 ms 8600 KB
01_rnd_02.txt RE 148 ms 8584 KB
01_rnd_03.txt RE 150 ms 8600 KB
01_rnd_04.txt RE 149 ms 8600 KB
01_rnd_05.txt RE 146 ms 8604 KB
01_rnd_06.txt RE 146 ms 8608 KB
01_rnd_07.txt RE 146 ms 8616 KB
01_rnd_08.txt RE 146 ms 8588 KB
01_rnd_09.txt AC 145 ms 8604 KB
01_rnd_10.txt RE 146 ms 8596 KB
01_rnd_11.txt RE 145 ms 8600 KB
01_rnd_12.txt RE 149 ms 8580 KB
01_rnd_13.txt RE 148 ms 8588 KB
01_rnd_14.txt RE 147 ms 8580 KB
01_rnd_15.txt AC 143 ms 8540 KB
01_rnd_16.txt AC 144 ms 8548 KB
01_rnd_17.txt RE 147 ms 8584 KB
01_rnd_18.txt AC 144 ms 8608 KB
01_rnd_19.txt RE 176 ms 8584 KB
02_maxrnd_00.txt RE 147 ms 8584 KB
02_maxrnd_01.txt RE 147 ms 8580 KB
02_maxrnd_02.txt RE 147 ms 8632 KB
02_maxrnd_03.txt RE 147 ms 8580 KB
02_maxrnd_04.txt RE 146 ms 8588 KB
03_empty_00.txt RE 148 ms 8572 KB
03_empty_01.txt RE 148 ms 8596 KB
03_empty_02.txt RE 148 ms 8460 KB