結果
| 問題 | No.2299 Antitypoglycemia |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-02-21 17:36:33 |
| 言語 | C++17(gcc12) (gcc 12.4.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 3 ms / 2,000 ms |
| + 877µs | |
| コード長 | 581 bytes |
| 記録 | |
| コンパイル時間 | 4,411 ms |
| コンパイル使用メモリ | 300,036 KB |
| 実行使用メモリ | 9,800 KB |
| 最終ジャッジ日時 | 2026-10-14 23:11:38 |
| 合計ジャッジ時間 | 5,955 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 |
ソースコード
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
using ll=long long;
void IO(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
}
ll P(ll p,ll mod){
ll res=1;
for(ll i=1;i<=p;i++){
res*=i;
res%=mod;
}
return res;
}
int main(){
IO();
ll n,a,b;
cin>>n>>a>>b;
ll mod=998244353;
ll ans=P(n,mod);
ans-=2*P(n-1,mod);
ans+=2*mod;
ans%=mod;
if(a!=b){
ans+=P(n-2,mod);
ans%=mod;
}
cout<<ans<<endl;
}