結果

問題 No.2001 Distanced Triple
ユーザー umezoumezo
提出日時 2022-07-08 22:56:46
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 842 bytes
コンパイル時間 1,863 ms
コンパイル使用メモリ 198,892 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-08-27 22:44:06
合計ジャッジ時間 3,055 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 WA -
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 WA -
testcase_11 AC 1 ms
4,376 KB
testcase_12 WA -
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 1 ms
4,380 KB
testcase_30 AC 2 ms
4,380 KB
testcase_31 WA -
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
 
#include<bits/stdc++.h>
using namespace std;

const int MOD=998244353;
const int i6=166374059;
const int i2=499122177;

int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  ll l,r,a,b,c;
  cin>>l>>r>>a>>b>>c;
  
  if(c<=a+b){
    ll d=l+a,u=r-b;
    if(u<d){
      cout<<0<<endl;
      return 0;
    }
    d%=MOD,u%=MOD;
    ll ans=0;
    ans=(ans+MOD-u*(u+1)%MOD*(2*u%MOD+1)%MOD*i6%MOD)%MOD;
    ans=(ans+(d-1+MOD)%MOD*d%MOD*((2*d%MOD-1+MOD)%MOD)%MOD*i6%MOD)%MOD;
    ans=(ans+(d+u)%MOD*u%MOD*(u+1)%MOD*i2%MOD)%MOD;
    ans=(ans+MOD-(d+u)%MOD*((d-1+MOD)%MOD)*d%MOD*i2%MOD)%MOD;
    ans=(ans+MOD-(d-1+MOD)%MOD*(u+1)%MOD*((u-d+1+MOD)%MOD)%MOD)%MOD;
    cout<<ans<<endl;
  }
  else{
    cout<<0<<endl;
  }
  
  return 0;
}
0