Submission #34294


Source Code Expand

Copy
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.util.List;
import java.util.ArrayList;

public class Main {

	static List<String> pretext = new ArrayList<String>();
	static int[] posit = new int[2];
	static int g;

	public static void main(String[] args) {
		// 半角アルファベットだけの行がくるまで読み続ける
		// Assist.readTo("^[a-zA-Z]*$", System.in);
		readTo(".*o.*", System.in);

		String last = pretext.get(pretext.size() - 1);
		g = last.indexOf("o");
		posit[0] = 0;
		posit[1] = (g + 1) / 2;

		
		
		ArrayList<String> hoge = new ArrayList<String>();
		for (int i = pretext.size() - 2; i > 0; i--) {
			hoge.add(pretext.get(i));
		}

		for (int i = 0; i < hoge.size(); i++) {
			String line = hoge.get(i);
			boolean moved = false;
			posit[0] = i;
			if (posit[1] - 1 != -1) {
				Character c = line.charAt(posit[1] - 1);
				if (c.equals('-')) {
					posit[1]--;
					moved = true;
				}
			}
			if (posit[1] * 2 < line.length() && !moved) {
				Character c = line.charAt(posit[1] * 2 + 1);
				System.out.println(c);
				if (c.equals('-')) {
					posit[1]++;
				}
			}
			System.out.println(posit[0] + "," + posit[1]);
		}

		for (String s : hoge) {
			System.out.println(s);
		}
		posit[1]++;
		System.out.println(posit[1]);
	}

	/**
	 * 任意の文字列が入力されるまで、外部入力を続ける
	 * 
	 * @param regex
	 *            終了を表す文字列 正規表現も使える
	 * @param is
	 *            外部入力
	 */
	static void readTo(String regex, InputStream is) {
		try {
			BufferedReader br = new BufferedReader(new InputStreamReader(is));
			String line = null; //
			do {
				line = br.readLine();
				pretext.add(line);
			} while (line != null && !line.matches(regex)); // lineがregexを含む場合は終了
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}
}

Submission Info

Submission Time
Task B - あみだくじ
User Satanabe1
Language Java (OpenJDK 1.7.0)
Score 0
Code Size 1980 Byte
Status WA
Exec Time 430 ms
Memory 19112 KB

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
WA × 20
RE × 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 RE 377 ms 18968 KB
00_sample_01.txt WA 369 ms 18960 KB
00_sample_02.txt WA 371 ms 19040 KB
00_sample_03.txt RE 386 ms 18904 KB
00_sample_04.txt RE 371 ms 18952 KB
00_sample_05.txt RE 373 ms 19076 KB
01_rnd_00.txt WA 376 ms 18956 KB
01_rnd_01.txt WA 379 ms 19036 KB
01_rnd_02.txt WA 380 ms 18960 KB
01_rnd_03.txt RE 424 ms 19080 KB
01_rnd_04.txt WA 401 ms 19032 KB
01_rnd_05.txt RE 409 ms 19080 KB
01_rnd_06.txt WA 411 ms 19084 KB
01_rnd_07.txt RE 384 ms 18964 KB
01_rnd_08.txt WA 375 ms 19080 KB
01_rnd_09.txt WA 408 ms 18956 KB
01_rnd_10.txt WA 383 ms 18948 KB
01_rnd_11.txt WA 378 ms 18948 KB
01_rnd_12.txt WA 383 ms 18952 KB
01_rnd_13.txt WA 380 ms 18952 KB
01_rnd_14.txt WA 385 ms 19036 KB
01_rnd_15.txt RE 371 ms 18944 KB
01_rnd_16.txt RE 379 ms 18972 KB
01_rnd_17.txt RE 429 ms 19040 KB
01_rnd_18.txt RE 430 ms 18952 KB
01_rnd_19.txt RE 372 ms 18952 KB
02_maxrnd_00.txt WA 384 ms 19112 KB
02_maxrnd_01.txt RE 380 ms 18956 KB
02_maxrnd_02.txt RE 383 ms 19076 KB
02_maxrnd_03.txt WA 380 ms 19084 KB
02_maxrnd_04.txt WA 388 ms 18956 KB
03_empty_00.txt WA 384 ms 19040 KB
03_empty_01.txt WA 375 ms 18972 KB
03_empty_02.txt WA 373 ms 18952 KB