Submission #33897


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 >= 0)
		{
			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 0
Code Size 1288 Byte
Status WA
Exec Time 407 ms
Memory 18560 KB

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
AC × 20
WA × 14
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 407 ms 18528 KB
00_sample_01.txt WA 391 ms 18476 KB
00_sample_02.txt WA 396 ms 18544 KB
00_sample_03.txt AC 398 ms 18484 KB
00_sample_04.txt AC 391 ms 18544 KB
00_sample_05.txt AC 388 ms 18560 KB
01_rnd_00.txt WA 386 ms 18416 KB
01_rnd_01.txt AC 397 ms 18552 KB
01_rnd_02.txt AC 401 ms 18536 KB
01_rnd_03.txt AC 395 ms 18552 KB
01_rnd_04.txt AC 399 ms 18480 KB
01_rnd_05.txt AC 396 ms 18468 KB
01_rnd_06.txt WA 385 ms 18548 KB
01_rnd_07.txt WA 380 ms 18476 KB
01_rnd_08.txt AC 386 ms 18544 KB
01_rnd_09.txt AC 397 ms 18484 KB
01_rnd_10.txt WA 398 ms 18540 KB
01_rnd_11.txt WA 404 ms 18540 KB
01_rnd_12.txt AC 403 ms 18544 KB
01_rnd_13.txt WA 391 ms 18532 KB
01_rnd_14.txt WA 397 ms 18456 KB
01_rnd_15.txt AC 387 ms 18548 KB
01_rnd_16.txt AC 395 ms 18528 KB
01_rnd_17.txt AC 390 ms 18536 KB
01_rnd_18.txt AC 384 ms 18480 KB
01_rnd_19.txt AC 393 ms 18528 KB
02_maxrnd_00.txt WA 393 ms 18536 KB
02_maxrnd_01.txt WA 396 ms 18544 KB
02_maxrnd_02.txt WA 389 ms 18552 KB
02_maxrnd_03.txt WA 391 ms 18548 KB
02_maxrnd_04.txt WA 375 ms 18528 KB
03_empty_00.txt AC 388 ms 18548 KB
03_empty_01.txt AC 380 ms 18428 KB
03_empty_02.txt AC 388 ms 18532 KB