結果
| 問題 |
No.2875 What is My Rank?
|
| コンテスト | |
| ユーザー |
nonon
|
| 提出日時 | 2024-09-06 22:39:15 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 743 bytes |
| コンパイル時間 | 2,014 ms |
| コンパイル使用メモリ | 195,668 KB |
| 最終ジャッジ日時 | 2025-02-24 04:37:33 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 WA * 26 |
ソースコード
#include<bits/stdc++.h>
#include<atcoder/modint>
using namespace std;
using mint=atcoder::modint998244353;
mint f(mint l, mint r){return (r-l)*(r-l-1)/2;}
int N,L[2<<17],R[2<<17];
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin>>N;
for(int i=0;i<N;i++)cin>>L[i]>>R[i],L[i]--;
mint ans=1;
for(int i=1;i<N;i++)
{
mint sum=0;
if(L[0]>=R[i])continue;
if(R[0]<L[i])
{
ans++;
continue;
}
if(L[0]<L[i])sum+=(R[i]-L[i])*(L[i]-L[0]);
if(R[0]<R[i])sum+=(R[0]-L[0])*(R[i]-R[0]);
sum+=f(max(L[0],L[i]),min(R[0],R[i]));
sum/=(R[i]-L[i]);
sum/=(R[0]-L[0]);
ans+=sum;
}
cout<<ans.val()<<endl;
}
nonon