結果
問題 |
No.110 しましまピラミッド
|
ユーザー |
![]() |
提出日時 | 2019-12-24 14:20:57 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 32 ms / 5,000 ms |
コード長 | 1,242 bytes |
コンパイル時間 | 196 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-09-21 23:45:07 |
合計ジャッジ時間 | 2,316 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 26 |
ソースコード
from collections import * import sys sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def MF(): return map(float, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LF(): return list(map(float, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def main(): wn = II() ww = LI() bn = II() bb = LI() ww.sort() bb.sort() h = 1 wid = ww[wn - 1] wi = wn - 2 bi = bn - 1 while 1: while bi>=0 and bb[bi] >= wid: bi -= 1 if bi<0:break wid=bb[bi] h+=1 bi-=1 while wi>=0 and ww[wi] >= wid: wi -= 1 if wi<0:break wid=ww[wi] h+=1 wi-=1 ans=h h = 1 wid = bb[bn - 1] wi = wn - 1 bi = bn - 2 while 1: while wi>=0 and ww[wi] >= wid: wi -= 1 if wi<0:break wid=ww[wi] h+=1 wi-=1 while bi>=0 and bb[bi] >= wid: bi -= 1 if bi<0:break wid=bb[bi] h+=1 bi-=1 if h>ans:ans=h print(ans) main()