Submission #2331801


Source Code Expand

import java.util.*;
public class Main {
	static int n;
	static ArrayList<String> jukugo;
	static String ans;
	static char current;
	static void dfs(String tlrb, boolean[] ini, int depth){
		if(depth == 4){
			ans += current;
			return;
		}
		int pos = ini[depth] ? 0:1;
		for(int i=0;i<n;i++){
			String tmp = jukugo.get(i);
			if(tlrb.charAt(depth) == tmp.charAt(pos)){
//				System.out.println("tmp:"+tmp);
				if(depth == 0){
					current = tmp.charAt(1 - pos);
//					System.out.println("current:" + current);
				}
				if(current == tmp.charAt(1-pos)){
//					System.out.println("depth:" + depth);
					dfs(tlrb,ini,depth+1);
				}
			}
		}
	}

	public static void main(String[] args){
		jukugo = new ArrayList<String>();
		Scanner sc = new Scanner(System.in);
		sc.hasNext();
		n = Integer.parseInt(sc.nextLine());
		for(int i=0;i<n;i++){
			sc.hasNext();
			jukugo.add(sc.nextLine());
		}
		ans="";
		while(sc.hasNext()){
			String tlrb="";
			boolean[] ini = new boolean[4];
			String[] tmp = new String[5];
			for(int i=0;i<5;i++){
				if(i!=0)sc.hasNext();
				tmp[i] = sc.nextLine();
//				System.out.println(tmp[i]);
			}
			tlrb += tmp[0].charAt(2);
			tlrb += tmp[2].charAt(0);
			tlrb += tmp[2].charAt(4);
			tlrb += tmp[4].charAt(2);
			ini[0] = tmp[1].charAt(2) == 0x2193;
			ini[1] = tmp[2].charAt(1) == 0x2192;
			ini[2] = tmp[2].charAt(3) == 0x2190;
			ini[3] = tmp[3].charAt(2) == 0x2191;
			dfs(tlrb,ini,0);
//				System.out.println("tlrb:"+tlrb);
		}
		System.out.println(ans);
/*		System.out.println(jukugo.size());
		for(int i=0;i<jukugo.size();i++) System.out.println(jukugo.get(i));
		System.out.println("↓ho↑ge←hoge□h→");*/
	}
}

Submission Info

Submission Time
Task E - 必殺!無限覇王斬!
User latte0119
Language Java8 (OpenJDK 1.8.0)
Score 100
Code Size 1731 Byte
Status AC
Exec Time 422 ms
Memory 66544 KB

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 22
Set Name Test Cases
All 05_sample_00.txt, 05_sample_01.txt, 05_sample_02.txt, 05_sample_03.txt, 05_sample_04.txt, 10_min_00.txt, 10_min_01.txt, 10_min_02.txt, 20_max_00.txt, 20_max_01.txt, 20_max_02.txt, 90_random_00.txt, 90_random_01.txt, 90_random_02.txt, 90_random_03.txt, 90_random_04.txt, 90_random_05.txt, 90_random_06.txt, 90_random_07.txt, 90_random_08.txt, 90_random_09.txt, 99_medium_00.txt
Case Name Status Exec Time Memory
05_sample_00.txt AC 92 ms 21844 KB
05_sample_01.txt AC 94 ms 21460 KB
05_sample_02.txt AC 92 ms 19284 KB
05_sample_03.txt AC 96 ms 19540 KB
05_sample_04.txt AC 94 ms 19028 KB
10_min_00.txt AC 92 ms 19540 KB
10_min_01.txt AC 93 ms 19540 KB
10_min_02.txt AC 92 ms 18900 KB
20_max_00.txt AC 364 ms 62964 KB
20_max_01.txt AC 357 ms 61744 KB
20_max_02.txt AC 360 ms 58328 KB
90_random_00.txt AC 159 ms 34004 KB
90_random_01.txt AC 360 ms 64232 KB
90_random_02.txt AC 295 ms 43492 KB
90_random_03.txt AC 311 ms 63024 KB
90_random_04.txt AC 344 ms 62084 KB
90_random_05.txt AC 422 ms 63624 KB
90_random_06.txt AC 371 ms 64272 KB
90_random_07.txt AC 366 ms 63400 KB
90_random_08.txt AC 350 ms 66544 KB
90_random_09.txt AC 354 ms 65312 KB
99_medium_00.txt AC 384 ms 65704 KB