結果
問題 |
No.2796 Small Matryoshka
|
ユーザー |
|
提出日時 | 2024-06-28 22:54:25 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 453 bytes |
コンパイル時間 | 209 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 116,352 KB |
最終ジャッジ日時 | 2024-06-28 22:54:31 |
合計ジャッジ時間 | 5,713 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 1 WA * 5 TLE * 1 -- * 12 |
ソースコード
from sys import stdin n = int(stdin.readline()) matryoshka_list = [list(map(int, stdin.readline().split())) for _ in range(n)] matryoshka_list = sorted(matryoshka_list, reverse=True, key=lambda x: (x[1],x[0])) res = 0 while len(matryoshka_list) > 1: r_in = matryoshka_list[-1][1] for i in range(len(matryoshka_list)-2, -1, -1): if r_in <= matryoshka_list[i][0]: del matryoshka_list[-1] break res += 1 del matryoshka_list[-1] print(res)