結果

問題 No.290 1010
ユーザー LeonardoneLeonardone
提出日時 2015-10-16 23:06:23
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 431 bytes
コンパイル時間 325 ms
コンパイル使用メモリ 11,416 KB
実行使用メモリ 813,648 KB
最終ジャッジ日時 2023-09-29 01:38:02
合計ジャッジ時間 6,460 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
15,196 KB
testcase_01 AC 83 ms
15,156 KB
testcase_02 AC 85 ms
15,212 KB
testcase_03 WA -
testcase_04 AC 84 ms
15,276 KB
testcase_05 AC 88 ms
15,268 KB
testcase_06 AC 83 ms
15,060 KB
testcase_07 AC 83 ms
15,060 KB
testcase_08 AC 83 ms
15,012 KB
testcase_09 AC 87 ms
15,156 KB
testcase_10 AC 82 ms
15,036 KB
testcase_11 AC 84 ms
15,048 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 84 ms
15,284 KB
testcase_15 AC 84 ms
15,036 KB
testcase_16 AC 83 ms
15,012 KB
testcase_17 AC 85 ms
15,196 KB
testcase_18 AC 86 ms
15,132 KB
testcase_19 AC 82 ms
15,160 KB
testcase_20 AC 645 ms
17,572 KB
testcase_21 MLE -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

#! ruby
# Try yukicoder
# author: Leornadone @ NEETSDKASU

N = gets.to_i
S = gets.chomp

# S[i,j]
# S[j+1,j+(j+1-i)] = S[j+1,j+1+(j-i)]

m = Hash.new

msk = (1 << N) - 1
s2 = S.to_i(2)

N.times do |i|
	st = s2 & msk
	(N - i).times do |j|
		if m.include? st
			b = i - (N - i - j)
			if m[st].include? b
				puts "YES"
				exit
			end
			m[st][i] = true
		else
			m[st] = {i => true}
		end
		st >>= 1
	end
	msk >>= 1
end

puts "NO"
0