QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#273212 | #7886. Not Another Eulerian Number Problem | _set_ | AC ✓ | 2ms | 5264kb | C++17 | 2.2kb | 2023-12-02 22:05:36 | 2023-12-02 22:05:37 |
Judging History
answer
// what is matter? never mind.
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,sse4,popcnt,abm,mmx,avx,avx2")
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
#define ll long long
#define ull unsigned long long
#define i128 __int128
//#define int long long
using namespace std;
inline int read()
{
char c=getchar();int x=0;bool f=0;
for(;!isdigit(c);c=getchar())f^=!(c^45);
for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
if(f)x=-x;return x;
}
#define mod 998244353
struct modint{
int x;
modint(int o=0){x=o;}
modint &operator = (int o){return x=o,*this;}
modint &operator +=(modint o){return x=x+o.x>=mod?x+o.x-mod:x+o.x,*this;}
modint &operator -=(modint o){return x=x-o.x<0?x-o.x+mod:x-o.x,*this;}
modint &operator *=(modint o){return x=1ll*x*o.x%mod,*this;}
modint &operator ^=(int b){
modint a=*this,c=1;
for(;b;b>>=1,a*=a)if(b&1)c*=a;
return x=c.x,*this;
}
modint &operator /=(modint o){return *this *=o^=mod-2;}
friend modint operator +(modint a,modint b){return a+=b;}
friend modint operator -(modint a,modint b){return a-=b;}
friend modint operator *(modint a,modint b){return a*=b;}
friend modint operator /(modint a,modint b){return a/=b;}
friend modint operator ^(modint a,int b){return a^=b;}
friend bool operator ==(modint a,int b){return a.x==b;}
friend bool operator !=(modint a,int b){return a.x!=b;}
bool operator ! () {return !x;}
modint operator - () {return x?mod-x:0;}
bool operator <(const modint&b)const{return x<b.x;}
};
inline modint qpow(modint x,int y){return x^y;}
#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;
#define maxn 200005
#define inf 0x3f3f3f3f
int a,n,m,m0,n0;
modint f[200005],g[200005];
signed main()
{
a=read(),n=read(),m=read(),n0=read();
int lst=0;
For(i,1,n0*a){
int x=read();
m0+=(lst>x),lst=x;
}
if(m<m0)puts("0"),exit(0);
f[m0]=1;
For(i,n0+1,n){
For(j,m0,m)
g[j]=(1ll*a*(i-1)+1-j)%mod*f[j-1]+(j+1)*f[j];
swap(f,g),memset(g,0,sizeof g);
}
modint res=f[m];
cout<<res.x;
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 5124kb
input:
1 4 2 2 2 1
output:
7
result:
ok 1 number(s): "7"
Test #2:
score: 0
Accepted
time: 0ms
memory: 5136kb
input:
2 4 2 2 1 2 2 1
output:
19
result:
ok 1 number(s): "19"
Test #3:
score: 0
Accepted
time: 1ms
memory: 5172kb
input:
1 1 0 1 1
output:
1
result:
ok 1 number(s): "1"
Test #4:
score: 0
Accepted
time: 1ms
memory: 5188kb
input:
3 1 0 1 1 1 1
output:
1
result:
ok 1 number(s): "1"
Test #5:
score: 0
Accepted
time: 1ms
memory: 5132kb
input:
4 1 0 1 1 1 1 1
output:
1
result:
ok 1 number(s): "1"
Test #6:
score: 0
Accepted
time: 1ms
memory: 5200kb
input:
5 1 0 1 1 1 1 1 1
output:
1
result:
ok 1 number(s): "1"
Test #7:
score: 0
Accepted
time: 1ms
memory: 5120kb
input:
10 1 0 1 1 1 1 1 1 1 1 1 1 1
output:
1
result:
ok 1 number(s): "1"
Test #8:
score: 0
Accepted
time: 0ms
memory: 5168kb
input:
1 3 2 1 1
output:
1
result:
ok 1 number(s): "1"
Test #9:
score: 0
Accepted
time: 1ms
memory: 5204kb
input:
3 3 2 3 2 2 2 3 3 3 1 1 1
output:
0
result:
ok 1 number(s): "0"
Test #10:
score: 0
Accepted
time: 1ms
memory: 5252kb
input:
3 3 2 2 1 1 2 2 2 1
output:
5
result:
ok 1 number(s): "5"
Test #11:
score: 0
Accepted
time: 1ms
memory: 5188kb
input:
3 3 2 1 1 1 1
output:
15
result:
ok 1 number(s): "15"
Test #12:
score: 0
Accepted
time: 1ms
memory: 5124kb
input:
3 3 1 2 2 2 2 1 1 1
output:
2
result:
ok 1 number(s): "2"
Test #13:
score: 0
Accepted
time: 1ms
memory: 5256kb
input:
1 4 0 4 4 2 1 3
output:
0
result:
ok 1 number(s): "0"
Test #14:
score: 0
Accepted
time: 1ms
memory: 5200kb
input:
2 4 1 4 1 4 4 3 3 2 2 1
output:
0
result:
ok 1 number(s): "0"
Test #15:
score: 0
Accepted
time: 1ms
memory: 5264kb
input:
2 4 2 4 1 3 3 2 2 4 4 1
output:
1
result:
ok 1 number(s): "1"
Test #16:
score: 0
Accepted
time: 0ms
memory: 5192kb
input:
2 4 2 1 1 1
output:
58
result:
ok 1 number(s): "58"
Test #17:
score: 0
Accepted
time: 1ms
memory: 5204kb
input:
2 4 1 2 1 1 2 2
output:
14
result:
ok 1 number(s): "14"
Test #18:
score: 0
Accepted
time: 2ms
memory: 5184kb
input:
1 8 7 3 2 1 3
output:
0
result:
ok 1 number(s): "0"
Test #19:
score: 0
Accepted
time: 1ms
memory: 5204kb
input:
1 8 0 4 1 2 3 4
output:
1
result:
ok 1 number(s): "1"
Test #20:
score: 0
Accepted
time: 0ms
memory: 5196kb
input:
1 8 4 4 4 3 1 2
output:
771
result:
ok 1 number(s): "771"
Test #21:
score: 0
Accepted
time: 0ms
memory: 5136kb
input:
1 8 1 4 4 3 2 1
output:
0
result:
ok 1 number(s): "0"
Test #22:
score: 0
Accepted
time: 2ms
memory: 5192kb
input:
1 8 7 1 1
output:
1
result:
ok 1 number(s): "1"
Test #23:
score: 0
Accepted
time: 1ms
memory: 5132kb
input:
1 9 2 5 4 3 1 5 2
output:
0
result:
ok 1 number(s): "0"
Test #24:
score: 0
Accepted
time: 1ms
memory: 5188kb
input:
1 9 7 8 6 5 8 3 4 7 2 1
output:
0
result:
ok 1 number(s): "0"
Test #25:
score: 0
Accepted
time: 1ms
memory: 5188kb
input:
1 9 7 7 5 3 2 4 7 6 1
output:
0
result:
ok 1 number(s): "0"
Test #26:
score: 0
Accepted
time: 1ms
memory: 5252kb
input:
1 9 7 6 2 1 3 5 6 4
output:
0
result:
ok 1 number(s): "0"
Test #27:
score: 0
Accepted
time: 2ms
memory: 5188kb
input:
1 9 3 3 1 2 3
output:
20420
result:
ok 1 number(s): "20420"
Test #28:
score: 0
Accepted
time: 0ms
memory: 5176kb
input:
1 10 0 10 5 6 10 1 3 2 4 7 8 9
output:
0
result:
ok 1 number(s): "0"
Test #29:
score: 0
Accepted
time: 2ms
memory: 5192kb
input:
1 10 7 2 2 1
output:
30973
result:
ok 1 number(s): "30973"
Test #30:
score: 0
Accepted
time: 1ms
memory: 5200kb
input:
1 10 1 6 6 3 5 2 4 1
output:
0
result:
ok 1 number(s): "0"
Test #31:
score: 0
Accepted
time: 2ms
memory: 5132kb
input:
1 10 2 1 1
output:
47840
result:
ok 1 number(s): "47840"
Test #32:
score: 0
Accepted
time: 2ms
memory: 5124kb
input:
1 10 5 2 2 1
output:
689155
result:
ok 1 number(s): "689155"
Extra Test:
score: 0
Extra Test Passed