結果

問題 No.3453 Crape Shop
コンテスト
ユーザー sakasama
提出日時 2026-02-28 13:35:08
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 66 ms / 2,000 ms
コード長 519 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 222 ms
コンパイル使用メモリ 77,832 KB
実行使用メモリ 81,828 KB
最終ジャッジ日時 2026-02-28 13:35:13
合計ジャッジ時間 2,579 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def solve():
    n = int(input())
    a,b = map(int, input().split())
    p = list(map(int, input().split()))

    for i, pi in enumerate(p):
        needa, needb= 0,0
        if pi==1:
            needa += 1
        elif pi==2:
            needb += 1
        else:
            needa += 1
            needb += 1
        if a-needa>=0 and b-needb>=0:
            a -= needa
            b -= needb
        else:
            print(i+1)
            return
    print(-1)
    return



if __name__ == "__main__":
    solve()
0