QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#364552 | #6736. Alice and Bob | Atmizz# | Compile Error | / | / | C++20 | 1.1kb | 2024-03-24 15:16:12 | 2024-03-24 15:16:13 |
Judging History
answer
#include <iostream>
#include <algorithm>
using namespace std;
const int mod = 998244353;
typedef long long LL;
#define int long long
int qmi(int a, int k, int p)
{
int res = 1;
while (k)
{
if (k & 1) res = (LL)res * a % p;
a = (LL)a * a % p;
k >>= 1;
}
return res;
}
int C(int a, int b, int p)
{
if (b > a) return 0;
int res = 1;
for (int i = 1, j = a; i <= b; i ++, j -- )
{
res = (LL)res * j % p;
res = (LL)res * qmi(i, p - 2, p) % p;
}
return res;
}
int lucas(LL a, LL b, int p)
{
if (a < p && b < p) return C(a, b, p);
return (LL)C(a % p, b % p, p) * lucas(a / p, b / p, p) % p;
}
signed main()
{
int n;
cin >> n;
vector<int> s(n+10);
s[0]=1;
for(int i=1;i<=n;i++) s[i]=s[i-1]*i%mod;
int sum=0;
for(int x=1;x<=n;x++){
sum=(sum+lucas(n-x,x-1,mod)*s[n-x]%mod*s[x-1]%mod)%mod;
//cout<<n-x<<' '<<x-1<<' '<<s[n-x]<<' '<<lucas(n-x,x-1,mod)<<endl;
}
cout<<(sum+mod)%mod<<endl;
}
Details
answer.code: In function ‘int main()’: answer.code:48:5: error: ‘vector’ was not declared in this scope 48 | vector<int> s(n+10); | ^~~~~~ answer.code:3:1: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’? 2 | #include <algorithm> +++ |+#include <vector> 3 | answer.code:7:13: error: expected primary-expression before ‘long’ 7 | #define int long long | ^~~~ answer.code:48:12: note: in expansion of macro ‘int’ 48 | vector<int> s(n+10); | ^~~ answer.code:49:5: error: ‘s’ was not declared in this scope 49 | s[0]=1; | ^