Submission #33987


Source Code Expand

Copy
import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		Scanner s = new Scanner(System.in);
		String[] str;
		str = s.nextLine().split(" ");
		int n = Integer.parseInt(str[0]);
		int l = Integer.parseInt(str[1]);
		boolean[][] f = new boolean[l][n-1];
		String ln;
		for(int i=0;i<l;i++)
		{
			ln = s.nextLine();
			for(int j=0;j<n-1;j++)
			{
				if(ln.charAt(j*2+1)=='-') f[i][j] = true;
			}
		}
		int nowl;
		ln = s.nextLine();
		nowl = ln.indexOf("o")/2;
		for(int i=l-1;i>=0;i--)
		{
			if(nowl<n-1 && f[i][nowl]) nowl++;
			else if(nowl>0 && f[i][nowl-1]) nowl--;
		}
		System.out.println(nowl+1);
	}
}

Submission Info

Submission Time
Task B - あみだくじ
User flour4445
Language Java (OpenJDK 1.7.0)
Score 100
Code Size 677 Byte
Status AC
Exec Time 922 ms
Memory 20576 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 466 ms 20396 KB
00_sample_01.txt AC 922 ms 20528 KB
00_sample_02.txt AC 435 ms 20492 KB
00_sample_03.txt AC 452 ms 20492 KB
00_sample_04.txt AC 464 ms 20492 KB
00_sample_05.txt AC 428 ms 20388 KB
01_rnd_00.txt AC 472 ms 20476 KB
01_rnd_01.txt AC 440 ms 20524 KB
01_rnd_02.txt AC 473 ms 20492 KB
01_rnd_03.txt AC 436 ms 20492 KB
01_rnd_04.txt AC 425 ms 20484 KB
01_rnd_05.txt AC 420 ms 20508 KB
01_rnd_06.txt AC 411 ms 20560 KB
01_rnd_07.txt AC 441 ms 20524 KB
01_rnd_08.txt AC 475 ms 20432 KB
01_rnd_09.txt AC 439 ms 20528 KB
01_rnd_10.txt AC 491 ms 20528 KB
01_rnd_11.txt AC 430 ms 20484 KB
01_rnd_12.txt AC 447 ms 20400 KB
01_rnd_13.txt AC 433 ms 20576 KB
01_rnd_14.txt AC 488 ms 20484 KB
01_rnd_15.txt AC 434 ms 20528 KB
01_rnd_16.txt AC 429 ms 20496 KB
01_rnd_17.txt AC 443 ms 20524 KB
01_rnd_18.txt AC 484 ms 20524 KB
01_rnd_19.txt AC 430 ms 20556 KB
02_maxrnd_00.txt AC 436 ms 20532 KB
02_maxrnd_01.txt AC 428 ms 20488 KB
02_maxrnd_02.txt AC 443 ms 20560 KB
02_maxrnd_03.txt AC 489 ms 20524 KB
02_maxrnd_04.txt AC 431 ms 20484 KB
03_empty_00.txt AC 434 ms 20492 KB
03_empty_01.txt AC 727 ms 20364 KB
03_empty_02.txt AC 453 ms 20404 KB