Submission #33707


Source Code Expand

Copy
import java.util.*;
import java.util.regex.*;
import static java.lang.Math.*;
import static java.lang.System.out;

// AOJ 7
public class Main {
	final Scanner sc=new Scanner(System.in);
	final int[] vx={0,1,0,-1,-1,1,1,-1}, vy={-1,0,1,0,-1,-1,1,1};
	final int INF=1<<26;
	final long INFL=Long.MAX_VALUE/4;
	final double EPS=1.0e-08;
	public static void main(String[] args) {
		//long s=System.currentTimeMillis();
		//new Main().A();
		new Main().doIt();
		//out.println((System.currentTimeMillis()-s)+"msec");
	}
	void doIt(){
		new B();
	}
	
	class B{
		B(){
			int W=sc.nextInt(),H=sc.nextInt();
			boolean[][] b=new boolean[W-1][H];
			sc.nextLine();
			for(int i=0; i<H; i++){
				char[] c=sc.nextLine().replaceAll("\\|", "").toCharArray();
				for(int j=0; j<W-1; j++)	if(c[j]=='-')	b[j][i]=true;
			}
			String line=sc.nextLine();
			int s=0;
			for(int i=0; i<line.length(); i++){
				if(line.charAt(i)=='o')	s=i/2;
			}
//			System.out.println(s);
//			for(int y=0; y<H; y++){
//				for(int x=0; x<W-1; x++)	System.out.print((b[x][y]?"-":"*"));
//				System.out.println();
//			}
			for(int y=H-1; y>=0; y--){
				if(s>0 && b[s-1][y])	s--;
				else if(s<W-1 && b[s][y])	s++;
			}
			System.out.println(s+1);
		}
	}
	
	void A(){
		boolean[] l=new boolean[11],e=new boolean[11];
		for(int i=0; i<6; i++)	e[sc.nextInt()]=true;
		int b=sc.nextInt();
		for(int i=0; i<6; i++)	l[sc.nextInt()]=true;
		int eq=0;
		for(int i=0; i<10; i++)	if(l[i] && e[i])	eq++;
		if(eq==6)	System.out.println(1);
		else if(eq==5 && l[b])	System.out.println(2);
		else if(eq==5)	System.out.println(3);
		else if(eq==4)	System.out.println(4);
		else if(eq==3)	System.out.println(5);
		else System.out.println(0);
	}
	static class Point{
		int x, y;
		Point(int x, int y){	this.x=x;	this.y=y;}
		Point(){	this.x=0; this.y=0;}
		@Override public String toString(){	return "("+this.x+","+this.y+")";}
		static boolean ok(int x,int y,int X,int Y,int min){	return (min<=x&&x<X)&&(min<=y&&y<Y);}
		static boolean ok(int x,int y,int X,int Y){	return ok(x,y,X,Y,0);}
	}
}

Submission Info

Submission Time
Task B - あみだくじ
User yabuuuuu
Language Java (OpenJDK 1.7.0)
Score 100
Code Size 2117 Byte
Status AC
Exec Time 451 ms
Memory 20600 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 415 ms 20452 KB
00_sample_01.txt AC 424 ms 20452 KB
00_sample_02.txt AC 419 ms 20468 KB
00_sample_03.txt AC 415 ms 20472 KB
00_sample_04.txt AC 412 ms 20540 KB
00_sample_05.txt AC 406 ms 20600 KB
01_rnd_00.txt AC 405 ms 20480 KB
01_rnd_01.txt AC 406 ms 20456 KB
01_rnd_02.txt AC 410 ms 20468 KB
01_rnd_03.txt AC 414 ms 20532 KB
01_rnd_04.txt AC 409 ms 20452 KB
01_rnd_05.txt AC 410 ms 20456 KB
01_rnd_06.txt AC 413 ms 20528 KB
01_rnd_07.txt AC 405 ms 20532 KB
01_rnd_08.txt AC 405 ms 20476 KB
01_rnd_09.txt AC 396 ms 20460 KB
01_rnd_10.txt AC 403 ms 20468 KB
01_rnd_11.txt AC 416 ms 20468 KB
01_rnd_12.txt AC 414 ms 20456 KB
01_rnd_13.txt AC 406 ms 20456 KB
01_rnd_14.txt AC 451 ms 20464 KB
01_rnd_15.txt AC 407 ms 20580 KB
01_rnd_16.txt AC 415 ms 20472 KB
01_rnd_17.txt AC 402 ms 20584 KB
01_rnd_18.txt AC 409 ms 20476 KB
01_rnd_19.txt AC 403 ms 20476 KB
02_maxrnd_00.txt AC 404 ms 20444 KB
02_maxrnd_01.txt AC 409 ms 20520 KB
02_maxrnd_02.txt AC 406 ms 20592 KB
02_maxrnd_03.txt AC 410 ms 20428 KB
02_maxrnd_04.txt AC 409 ms 20592 KB
03_empty_00.txt AC 419 ms 20452 KB
03_empty_01.txt AC 410 ms 20556 KB
03_empty_02.txt AC 403 ms 20576 KB