結果
問題 | No.2409 Strange Werewolves |
ユーザー | keisuke6 |
提出日時 | 2023-08-11 21:28:51 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 899 bytes |
コンパイル時間 | 2,125 ms |
コンパイル使用メモリ | 203,504 KB |
実行使用メモリ | 19,900 KB |
最終ジャッジ日時 | 2024-11-18 15:26:13 |
合計ジャッジ時間 | 3,082 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 22 ms
19,728 KB |
testcase_01 | AC | 25 ms
19,672 KB |
testcase_02 | AC | 24 ms
19,600 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | AC | 28 ms
19,716 KB |
testcase_07 | WA | - |
testcase_08 | AC | 26 ms
19,628 KB |
testcase_09 | WA | - |
testcase_10 | AC | 24 ms
19,692 KB |
testcase_11 | WA | - |
testcase_12 | AC | 25 ms
19,724 KB |
testcase_13 | WA | - |
testcase_14 | AC | 26 ms
19,672 KB |
testcase_15 | WA | - |
testcase_16 | AC | 25 ms
19,628 KB |
testcase_17 | WA | - |
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/stl_pair.h:61, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/stl_algobase.h:64, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/specfun.h:45, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/cmath:1935, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/x86_64-pc-linux-gnu/bits/stdc++.h:41, from main.cpp:1: In function 'std::_Require<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = long long int]', inlined from 'int main()' at main.cpp:28:7: /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/move.h:205:11: warning: 'd' may be used uninitialized [-Wmaybe-uninitialized] 205 | __a = _GLIBCXX_MOVE(__b); | ^ main.cpp: In function 'int main()': main.cpp:25:19: note: 'd' was declared here 25 | int a,b,c,d; | ^
ソースコード
#include <bits/stdc++.h> using namespace std; #define int long long const int mod = 998244353; vector<long long> fact, fact_inv, inv; void init_nCk(int SIZE) { fact.resize(SIZE + 5); fact_inv.resize(SIZE + 5); inv.resize(SIZE + 5); fact[0] = fact[1] = 1; fact_inv[0] = fact_inv[1] = 1; inv[1] = 1; for (int i = 2; i < SIZE + 5; i++) { fact[i] = fact[i - 1] * i % mod; inv[i] = mod - inv[mod % i] * (mod / i) % mod; fact_inv[i] = fact_inv[i - 1] * inv[i] % mod; } } long long nCk(int n, int k) { if(n < k || n < 0 || k < 0) return 0; return fact[n] * (fact_inv[k] * fact_inv[n - k] % mod) % mod; } signed main(){ init_nCk(700000); int a,b,c,d; cin>>a>>b>>c,d; if(c == 0){ swap(c,d); swap(a,b); } int ans = nCk(a+b-c-1,b-1); for(int i=1;i<=b;i++) ans = (ans*i)%mod; for(int i=a;i>c;i--) ans = (ans*i)%mod; cout<<ans<<endl; }