結果

問題 No.110 しましまピラミッド
ユーザー ゆるくゆるく
提出日時 2014-12-25 01:46:55
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,218 bytes
コンパイル時間 71 ms
コンパイル使用メモリ 10,876 KB
実行使用メモリ 10,608 KB
最終ジャッジ日時 2023-08-28 17:02:54
合計ジャッジ時間 2,512 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 30 ms
10,388 KB
testcase_03 AC 30 ms
10,420 KB
testcase_04 AC 30 ms
10,356 KB
testcase_05 AC 30 ms
10,348 KB
testcase_06 AC 29 ms
10,376 KB
testcase_07 AC 30 ms
10,388 KB
testcase_08 AC 30 ms
10,388 KB
testcase_09 AC 29 ms
10,408 KB
testcase_10 AC 29 ms
10,376 KB
testcase_11 AC 30 ms
10,424 KB
testcase_12 AC 30 ms
10,460 KB
testcase_13 AC 29 ms
10,400 KB
testcase_14 AC 30 ms
10,384 KB
testcase_15 AC 29 ms
10,376 KB
testcase_16 AC 30 ms
10,408 KB
testcase_17 AC 29 ms
10,380 KB
testcase_18 AC 29 ms
10,368 KB
testcase_19 AC 30 ms
10,468 KB
testcase_20 AC 29 ms
10,376 KB
testcase_21 AC 29 ms
10,376 KB
testcase_22 AC 29 ms
10,412 KB
testcase_23 AC 29 ms
10,488 KB
testcase_24 AC 29 ms
10,468 KB
testcase_25 AC 30 ms
10,420 KB
testcase_26 AC 30 ms
10,316 KB
testcase_27 AC 30 ms
10,420 KB
testcase_28 AC 29 ms
10,352 KB
testcase_29 AC 29 ms
10,324 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

n1 = int(input())
w = list(-(int(_)) for _ in input().split()) 

n2 = int(input())
b = list(map(int, input().split()))

w1 = deque(sorted(w))
w1.append(0xFFFF)
b1 = deque(reversed(sorted(b)))
b1.append(0xFFFF)
w2 = deque(sorted(w))
w2.append(0xFFFF)
b2 = deque(reversed(sorted(b)))
b2.append(0xFFFF)
ww = [0xFFFF]
bb = [-(0xFFFF)]
while(not(w1[0] == b1[0] == 0xFFFF) and not(w2[0] == b2[0] == 0xFFFF)):
  if ww[-1] > 0:
    if ww[-1] > abs(w1[0]):
      ww.append(w1.popleft())
    elif w1[0] == 0xFFFF:
      b1[0] = 0xFFFF
    else:
      w1.popleft()
  else:
    if abs(ww[-1]) > b1[0]:
      ww.append(b1.popleft())
    elif b1[0] == 0xFFFF:
      w1[0] = 0xFFFF
    else:
      b1.popleft()
  if bb[-1] > 0:
    if bb[-1] > abs(w2[0]):
      bb.append(w2.popleft())
    elif w2[0] == 0xFFFF:
      b2[0] = 0xFFFF
    else:
      w2.popleft()
  else:
    if abs(bb[-1]) > b2[0]:
      bb.append(b2.popleft())
    elif b2[0] == 0xFFFF:
      w2[0] = 0xFFFF
    else:
      b2.popleft()
print(max(len(ww),len(bb)) - 1)
0