Submission #33807


Source Code Expand

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

using Ustok.Util;

class Program
{
	static void Main(string[] args)
	{
		int[] a = Console.ReadLine().Split(' ').Select(i => i.ToInt()).ToArray();
		int N = a[0], L = a[1];

		char[][] field = new char[L][];
		for (int i = 0; i < L; i++)
		{
			field[i] = Console.ReadLine().ToArray();
		}
		string m = Console.ReadLine();

		int p = getp(m);

		for (int i = L - 1; i >= 0; i--)
		{
			if (p > 0 && field[i][p - 1] == '-')
			{
				p -= 2;
			}
			else if (p < field[i].Length-1 && field[i][p + 1] == '-')
			{
				p += 2;
			}
		}
		Console.WriteLine((p / 2) + 1);
	}

	static int getp(string l)
	{
		for (int i = 0; i < l.Length; i++)
		{
			if (l[i] == 'o') return i;
		}
		return 0;
	}

}

namespace Ustok.Util
{
	public static class Extensions
	{
		public static int ToInt(this string s)
		{
			return int.Parse(s);
		}

		public static double ToDouble(this string s)
		{
			return double.Parse(s);
		}

		public static float ToFloat(this string s)
		{
			return float.Parse(s);
		}
	}

}

Submission Info

Submission Time
Task B - あみだくじ
User nankotsu230
Language C# (Mono 2.10.8.1)
Score 100
Code Size 1148 Byte
Status AC
Exec Time 206 ms
Memory 8744 KB

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 34
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 149 ms 8696 KB
00_sample_01.txt AC 150 ms 8680 KB
00_sample_02.txt AC 148 ms 8684 KB
00_sample_03.txt AC 151 ms 8680 KB
00_sample_04.txt AC 148 ms 8740 KB
00_sample_05.txt AC 146 ms 8736 KB
01_rnd_00.txt AC 147 ms 8676 KB
01_rnd_01.txt AC 146 ms 8712 KB
01_rnd_02.txt AC 143 ms 8684 KB
01_rnd_03.txt AC 148 ms 8680 KB
01_rnd_04.txt AC 147 ms 8636 KB
01_rnd_05.txt AC 147 ms 8652 KB
01_rnd_06.txt AC 143 ms 8744 KB
01_rnd_07.txt AC 145 ms 8680 KB
01_rnd_08.txt AC 147 ms 8672 KB
01_rnd_09.txt AC 150 ms 8720 KB
01_rnd_10.txt AC 146 ms 8680 KB
01_rnd_11.txt AC 146 ms 8692 KB
01_rnd_12.txt AC 156 ms 8672 KB
01_rnd_13.txt AC 144 ms 8612 KB
01_rnd_14.txt AC 149 ms 8684 KB
01_rnd_15.txt AC 149 ms 8744 KB
01_rnd_16.txt AC 149 ms 8616 KB
01_rnd_17.txt AC 145 ms 8676 KB
01_rnd_18.txt AC 149 ms 8676 KB
01_rnd_19.txt AC 148 ms 8688 KB
02_maxrnd_00.txt AC 145 ms 8664 KB
02_maxrnd_01.txt AC 144 ms 8736 KB
02_maxrnd_02.txt AC 206 ms 8676 KB
02_maxrnd_03.txt AC 150 ms 8736 KB
02_maxrnd_04.txt AC 151 ms 8668 KB
03_empty_00.txt AC 163 ms 8624 KB
03_empty_01.txt AC 150 ms 8680 KB
03_empty_02.txt AC 152 ms 8612 KB