結果
問題 | No.2875 What is My Rank? |
ユーザー |
![]() |
提出日時 | 2024-09-06 23:12:10 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 408 ms / 2,000 ms |
コード長 | 436 bytes |
コンパイル時間 | 306 ms |
コンパイル使用メモリ | 82,456 KB |
実行使用メモリ | 77,088 KB |
最終ジャッジ日時 | 2024-09-06 23:12:23 |
合計ジャッジ時間 | 7,982 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
ソースコード
N = int(input())mod = 998244353ans = 1L,R = map(int,input().split())D = R - L + 1for i in range(1,N):l,r = map(int,input().split())if R < l:ans += 1continueelif r < L:continuell = max(l,L)rr = min(r,R)d = r - l + 1n = rr - ll + 1res = (2 * r - ll - rr) * nres //= 2res = res * pow(d,-1,mod) % modres += (ll - L)res = res * pow(D,-1,mod) % modans = (ans + res) % modprint(ans)