Submission #33921


Source Code Expand

Copy
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main
{
	public static void main(String[] args)
	{
		try
		{
		BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));

		String s = bufferedReader.readLine();

		StringTokenizer tokenizer = new StringTokenizer(s);

		int w = Integer.valueOf(tokenizer.nextToken());
		int h = Integer.valueOf(tokenizer.nextToken());

		String[] rows = new String[h+1];
		for(int i = 0; i < rows.length; i++)
		{
			rows[i] = bufferedReader.readLine();
		}


		int rx = 0;
		int ry = h;

		char[][] table = new char[w*2-1][h+1];
		for(int i = 0; i < h+1; i++)
		{
			for(int j = 0; j < w*2-1; j++)
			{
				table[j][i] = rows[i].charAt(j);
			}
		}

		for(int i = 0; i < w*2-1; i++)
		{
			if(table[i][h] == 'o')
			{
				rx = i;
				break;
			}
		}

		ry -= 1;

		while(ry - 1 >= -1)
		{
			if(rx - 1 >= 0 && table[rx - 1][ry] == '-')
			{
				rx -= 2;
				ry -= 1;
			} else
			if(rx + 1 < w*2-1 && table[rx + 1][ry] == '-')
			{
				rx += 2;
				ry -= 1;
			}else
			{
				ry -= 1;
			}
		}

		System.out.println(rx/2+1);
		}
		catch(IOException e)
		{
		}
	}
}

Submission Info

Submission Time
Task B - あみだくじ
User Flandrome
Language Java (OpenJDK 1.7.0)
Score 100
Code Size 1289 Byte
Status AC
Exec Time 469 ms
Memory 18640 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 368 ms 18640 KB
00_sample_01.txt AC 374 ms 18400 KB
00_sample_02.txt AC 368 ms 18480 KB
00_sample_03.txt AC 371 ms 18504 KB
00_sample_04.txt AC 372 ms 18396 KB
00_sample_05.txt AC 375 ms 18552 KB
01_rnd_00.txt AC 369 ms 18604 KB
01_rnd_01.txt AC 384 ms 18548 KB
01_rnd_02.txt AC 371 ms 18532 KB
01_rnd_03.txt AC 361 ms 18544 KB
01_rnd_04.txt AC 384 ms 18552 KB
01_rnd_05.txt AC 381 ms 18408 KB
01_rnd_06.txt AC 422 ms 18500 KB
01_rnd_07.txt AC 374 ms 18408 KB
01_rnd_08.txt AC 375 ms 18476 KB
01_rnd_09.txt AC 371 ms 18420 KB
01_rnd_10.txt AC 370 ms 18412 KB
01_rnd_11.txt AC 394 ms 18548 KB
01_rnd_12.txt AC 367 ms 18396 KB
01_rnd_13.txt AC 469 ms 18540 KB
01_rnd_14.txt AC 375 ms 18508 KB
01_rnd_15.txt AC 380 ms 18476 KB
01_rnd_16.txt AC 372 ms 18540 KB
01_rnd_17.txt AC 374 ms 18412 KB
01_rnd_18.txt AC 434 ms 18540 KB
01_rnd_19.txt AC 387 ms 18428 KB
02_maxrnd_00.txt AC 370 ms 18476 KB
02_maxrnd_01.txt AC 365 ms 18532 KB
02_maxrnd_02.txt AC 368 ms 18404 KB
02_maxrnd_03.txt AC 367 ms 18480 KB
02_maxrnd_04.txt AC 395 ms 18548 KB
03_empty_00.txt AC 376 ms 18556 KB
03_empty_01.txt AC 371 ms 18404 KB
03_empty_02.txt AC 374 ms 18556 KB