結果

問題 No.3074 Divide Points Fairly
ユーザー gew1fw
提出日時 2025-06-12 16:15:31
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 530 bytes
コンパイル時間 228 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 94,848 KB
最終ジャッジ日時 2025-06-12 16:16:24
合計ジャッジ時間 10,786 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 42
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    import sys
    input = sys.stdin.read().split()
    n = int(input[0])
    intervals = []
    idx = 1
    for _ in range(n):
        a = int(input[idx])
        b = int(input[idx + 1])
        intervals.append((a, b))
        idx += 2

    # Sort intervals by their right end
    intervals.sort(key=lambda x: x[1])

    last = -1
    for a, b in intervals:
        if a > last:
            last = b

    # Since the problem can always be satisfied, output Yes
    print("Yes")

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