結果

問題 No.110 しましまピラミッド
ユーザー titia
提出日時 2022-01-31 02:07:16
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 30 ms / 5,000 ms
コード長 453 bytes
コンパイル時間 91 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-06-11 08:37:54
合計ジャッジ時間 1,753 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

a=int(input())
W=list(map(int,input().split()))
b=int(input())
B=list(map(int,input().split()))

W=[(w,0) for w in W]
B=[(b,1) for b in B]

A=W+B
A.sort()

ANS=0
now0=-10
now=0

for i in range(len(A)):
    if A[i][0]!=now0 and A[i][1]!=now:
        ANS+=1
        now^=1
        now0=A[i][0]

ANS2=0
now0=-10
now=1

for i in range(len(A)):
    if A[i][0]!=now0 and A[i][1]!=now:
        ANS2+=1
        now^=1
        now0=A[i][0]

print(max(ANS,ANS2))
0