Submission #34520


Source Code Expand

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

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]);

            if (vCount == 1)
            {
                Console.WriteLine("1");
                return;
            }

            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 2153 Byte
Status RE
Exec Time 177 ms
Memory 8724 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 142 ms 8164 KB
00_sample_01.txt AC 147 ms 8592 KB
00_sample_02.txt AC 151 ms 8724 KB
00_sample_03.txt AC 135 ms 8164 KB
00_sample_04.txt AC 151 ms 8720 KB
00_sample_05.txt RE 149 ms 8624 KB
01_rnd_00.txt RE 150 ms 8652 KB
01_rnd_01.txt RE 153 ms 8668 KB
01_rnd_02.txt RE 151 ms 8620 KB
01_rnd_03.txt RE 151 ms 8568 KB
01_rnd_04.txt RE 149 ms 8672 KB
01_rnd_05.txt RE 150 ms 8672 KB
01_rnd_06.txt RE 148 ms 8544 KB
01_rnd_07.txt RE 156 ms 8672 KB
01_rnd_08.txt RE 149 ms 8648 KB
01_rnd_09.txt AC 148 ms 8612 KB
01_rnd_10.txt RE 153 ms 8652 KB
01_rnd_11.txt RE 148 ms 8664 KB
01_rnd_12.txt RE 149 ms 8656 KB
01_rnd_13.txt RE 152 ms 8664 KB
01_rnd_14.txt RE 152 ms 8648 KB
01_rnd_15.txt AC 138 ms 8244 KB
01_rnd_16.txt AC 139 ms 8220 KB
01_rnd_17.txt RE 177 ms 8640 KB
01_rnd_18.txt AC 137 ms 8164 KB
01_rnd_19.txt RE 150 ms 8656 KB
02_maxrnd_00.txt RE 151 ms 8580 KB
02_maxrnd_01.txt RE 149 ms 8552 KB
02_maxrnd_02.txt RE 152 ms 8656 KB
02_maxrnd_03.txt RE 159 ms 8648 KB
02_maxrnd_04.txt RE 152 ms 8652 KB
03_empty_00.txt RE 153 ms 8648 KB
03_empty_01.txt RE 153 ms 8668 KB
03_empty_02.txt RE 156 ms 8656 KB