結果

問題 No.1884 Sequence
ユーザー floraflora
提出日時 2022-03-25 21:49:32
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,184 bytes
コンパイル時間 326 ms
コンパイル使用メモリ 82,256 KB
実行使用メモリ 118,500 KB
最終ジャッジ日時 2024-04-22 06:30:00
合計ジャッジ時間 8,837 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
57,472 KB
testcase_01 AC 37 ms
51,968 KB
testcase_02 AC 38 ms
52,480 KB
testcase_03 AC 38 ms
52,352 KB
testcase_04 AC 38 ms
52,096 KB
testcase_05 AC 38 ms
52,352 KB
testcase_06 AC 38 ms
52,480 KB
testcase_07 AC 38 ms
51,712 KB
testcase_08 AC 39 ms
52,096 KB
testcase_09 AC 38 ms
51,968 KB
testcase_10 AC 149 ms
117,984 KB
testcase_11 AC 149 ms
118,316 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 76 ms
92,032 KB
testcase_15 AC 124 ms
107,264 KB
testcase_16 AC 150 ms
117,936 KB
testcase_17 AC 102 ms
109,312 KB
testcase_18 AC 106 ms
107,648 KB
testcase_19 AC 105 ms
109,056 KB
testcase_20 AC 119 ms
106,796 KB
testcase_21 AC 113 ms
108,160 KB
testcase_22 AC 127 ms
107,104 KB
testcase_23 AC 152 ms
118,384 KB
testcase_24 AC 151 ms
118,500 KB
testcase_25 AC 148 ms
117,484 KB
testcase_26 AC 149 ms
117,664 KB
testcase_27 AC 74 ms
96,896 KB
testcase_28 AC 76 ms
96,640 KB
testcase_29 AC 77 ms
96,640 KB
testcase_30 AC 158 ms
103,680 KB
testcase_31 AC 117 ms
106,368 KB
testcase_32 AC 156 ms
116,876 KB
testcase_33 AC 115 ms
116,476 KB
testcase_34 AC 116 ms
116,284 KB
testcase_35 AC 80 ms
100,736 KB
testcase_36 AC 111 ms
106,144 KB
testcase_37 AC 114 ms
116,404 KB
testcase_38 AC 117 ms
114,856 KB
testcase_39 TLE -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
ori_A=list(map(int,input().split()))
#0を除いてソートしつつ0の数を覚えておく
#0にはできない
#あとは等差を決め打ちして確認すればいいのでは?
zero=0
A=[]
for a in ori_A:
	if a==0:
		zero+=1
	else:
		A.append(a)

A.sort()

if len(A)<2:
	print("Yes")
else:
	#この場合はA[0],A[1]をみて、ありうる等差を全部網羅する
	for z in range(zero+1):
		#z個のzをA[0],A[1]の間にいれて等差数列を作る
		if (A[1]-A[0])%(z+1)==0:
			#z+1で割り切れるときのみ考えればOK
			#これが等差
			r=(A[1]-A[0])//(z+1)
		else:
			continue

		#あとはrずつ足していって、等差数列が構成できるかを見る
		idx=0
		flag=True
		while idx<len(A)-1:
			for zz in range(zero+1):
				#次の項といまの項の間に1つ以上の0をいれて等差数列にできますか?
				if A[idx]+(zz+1)*r==A[idx+1]:
					#この場合等差数列としてOK
					#zeroをへらす
					zero-=zz
					idx+=1
					break
			else:
				#見つからなかったのでこのrではダメですね
				flag=False
			if not flag:
				break
		if flag:
			print("Yes")
			exit()
	print("No")


			


0