結果
問題 | No.110 しましまピラミッド |
ユーザー |
![]() |
提出日時 | 2024-01-27 13:33:59 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 44 ms / 5,000 ms |
コード長 | 680 bytes |
コンパイル時間 | 317 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 52,352 KB |
最終ジャッジ日時 | 2024-09-28 09:36:08 |
合計ジャッジ時間 | 2,681 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 26 |
ソースコード
NW = int(input()) W = list(map(int,input().split())) NB = int(input()) B = list(map(int,input().split())) W.sort() B.sort() WB = [W+[0],B+[0]] NWB = [NW,NB] def solve(x): tmp = [] wb = [0,0] turn = x now = 0 b = 0 cnt = 0 while wb[turn] < NWB[turn]: while wb[turn] < NWB[turn] and now >= WB[turn][wb[turn]]: wb[turn] += 1 if WB[turn][wb[turn]] == 0: #print(tmp,cnt) return cnt now = WB[turn][wb[turn]] tmp.append((turn,now)) wb[turn] += 1 cnt += 1 turn ^= 1 #print(tmp,cnt) return cnt ans = 0 for i in range(2): ans = max(ans,solve(i)) print(ans)