結果
| 問題 | No.2001 Distanced Triple |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-11-25 16:14:28 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,239 bytes |
| コンパイル時間 | 3,362 ms |
| コンパイル使用メモリ | 279,008 KB |
| 実行使用メモリ | 7,852 KB |
| 最終ジャッジ日時 | 2025-11-25 16:14:33 |
| 合計ジャッジ時間 | 4,581 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 WA * 2 |
ソースコード
#include<bits/stdc++.h>
#if __has_include(<atcoder/all>)
#include<atcoder/modint>
#endif
using namespace std;
#define done(...) return pp(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;lin(__VA_ARGS__)
#define defpp template<ostream&o=cout>void pp(const auto&...a){[[maybe_unused]]const char*c="";((o<<c<<a,c=" "),...);o<<'\n';}void epp(const auto&...a){pp<cerr>(a...);}
#define entry defpp void main();void main2();}int main(){my::io();my::main();}namespace my{
#define use_ml998244353 using ml=atcoder::modint998244353;
namespace my{
auto&operator<<(ostream&o,const atcoder::modint998244353&x){return o<<(int)x.val();}
void io(){cin.tie(nullptr)->sync_with_stdio(0);cout<<fixed<<setprecision(15);}
using ll=long long;
void lin(auto&...a){(cin>>...>>a);}
constexpr auto square(auto x){return x*x;}
constexpr auto cube(auto x){return x*x*x;}
bool amax(auto&a,const auto&b){return a<b?a=b,1:0;}
}
namespace my{entry
void main(){
LL(S,T);
LL(A,B,C);
S=S+A+B;
ll U=-A-B+C;
if(U>T-S)done(0);
amax(U,0);
ll F=T-S;
use_ml998244353
ml ans=0;
ans+=cube<ml>(F)/6;
ans+=square<ml>(F);
ans-=ml(F)*U*U/2;
ans-=ml(F)*U/2;
ans+=ml(F)*11/6;
ans+=cube<ml>(U)/3;
ans-=square<ml>(U)/2;
ans-=ml(U)*5/6;
ans+=1;
pp(ans);
}}