提出 #42902201


ソースコード 拡げる

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) throws Exception {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			Set<String> set = new HashSet<>();
			for (int i = 0; i < n; i++) {
				String val = scanner.next();
				if (set.size() > 0) {
					for (String v : set) {
						if (check(v + val) || check(val + v)) {
							System.out.println("Yes");
							return;
						}
					}
				}
				set.add(val);
			}
			System.out.println("No");
		}
	}

	private static boolean check(String val) {
		for (int i = 0, j = val.length() - 1; i < j; i++, j--) {
			if (val.charAt(i) != val.charAt(j)) {
				return false;
			}
		}
		return true;
	}
}

提出情報

提出日時
問題 B - racecar
ユーザ kmatsu
言語 Java (OpenJDK 11.0.6)
得点 200
コード長 792 Byte
結果 AC
実行時間 196 ms
メモリ 41220 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 200 / 200
結果
AC × 3
AC × 30
セット名 テストケース
Sample example_00.txt, example_01.txt, example_02.txt
All example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt
ケース名 結果 実行時間 メモリ
example_00.txt AC 193 ms 39000 KiB
example_01.txt AC 154 ms 39336 KiB
example_02.txt AC 163 ms 39168 KiB
hand_00.txt AC 158 ms 39216 KiB
hand_01.txt AC 189 ms 41220 KiB
hand_02.txt AC 188 ms 40392 KiB
hand_03.txt AC 160 ms 39188 KiB
hand_04.txt AC 158 ms 39080 KiB
hand_05.txt AC 166 ms 39136 KiB
hand_06.txt AC 174 ms 39764 KiB
random_00.txt AC 188 ms 40276 KiB
random_01.txt AC 192 ms 41140 KiB
random_02.txt AC 192 ms 40640 KiB
random_03.txt AC 190 ms 40068 KiB
random_04.txt AC 184 ms 40524 KiB
random_05.txt AC 181 ms 40896 KiB
random_06.txt AC 174 ms 40232 KiB
random_07.txt AC 185 ms 40368 KiB
random_08.txt AC 193 ms 41164 KiB
random_09.txt AC 185 ms 40620 KiB
random_10.txt AC 196 ms 41080 KiB
random_11.txt AC 182 ms 40488 KiB
random_12.txt AC 184 ms 40468 KiB
random_13.txt AC 189 ms 41180 KiB
random_14.txt AC 181 ms 40396 KiB
random_15.txt AC 189 ms 40636 KiB
random_16.txt AC 193 ms 40796 KiB
random_17.txt AC 192 ms 41124 KiB
random_18.txt AC 179 ms 39764 KiB
random_19.txt AC 179 ms 40492 KiB