QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#153099 | #6548. Courses | Crysfly | RE | 10ms | 44688kb | C++17 | 2.7kb | 2023-08-29 12:05:02 | 2023-08-29 12:05:02 |
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 int long long
#define ull unsigned 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;}
vector<modint> fac,ifac,iv;
inline void initC(int n)
{
if(iv.empty())fac=ifac=iv=vector<modint>(2,1);
int m=iv.size(); ++n;
if(m>=n)return;
iv.resize(n),fac.resize(n),ifac.resize(n);
For(i,m,n-1){
iv[i]=iv[mod%i]*(mod-mod/i);
fac[i]=fac[i-1]*i,ifac[i]=ifac[i-1]*iv[i];
}
}
inline modint C(int n,int m){
if(m<0||n<m)return 0;
return initC(n),fac[n]*ifac[m]*ifac[n-m];
}
inline modint sign(int n){return (n&1)?(mod-1):(1);}
#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 n,m,k,c[maxn],d[maxn],w[maxn];
modint f[1005][10005];
signed main()
{
m=read();
For(i,1,m)c[i]=read(),d[i]=read(),w[i]=read();
n=read(),k=read(),k+=n;
f[0][n]=1;
For(i,0,n-1){
For(j,0,n*2)if(f[i][j].x){
For(p,1,m)
f[i+c[p]][j+d[p]]+=f[i][j]*w[p];
}
}
For(i,1,n){
modint res=0;
For(j,k,n*2)res+=f[i][j];
cout<<res.x<<'\n';
}
return 0;
}
/*
100
1 0 4
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 43608kb
input:
1 1 1 2 5 2
output:
0 4 8 16 32
result:
ok 5 number(s): "0 4 8 16 32"
Test #2:
score: 0
Accepted
time: 1ms
memory: 44432kb
input:
2 1 -1 1 1 1 2 4 2
output:
0 4 8 48
result:
ok 4 number(s): "0 4 8 48"
Test #3:
score: 0
Accepted
time: 1ms
memory: 44452kb
input:
99 1 -1 4155 1 0 1361 1 1 5264 2 -2 1903 2 -1 3676 2 0 9643 2 1 6909 2 2 4902 3 -3 3561 3 -2 8489 3 -1 4948 3 0 1282 3 1 3653 3 2 674 3 3 2220 4 -4 5402 4 -3 6923 4 -2 3831 4 -1 9369 4 0 3878 4 1 259 4 2 9008 4 3 2619 4 4 3971 5 -5 3 5 -4 1945 5 -3 9781 5 -2 6504 5 -1 2392 5 0 2685 5 1 5313 5 2 6698...
output:
6625 87655919 636581604 585696387 17620788 88066998 904901665 846840737 360330214 620333919 136263062 39075213 241172245 519044851 379562425 532682226 777144743 462280426 307921116 700072043 707231396 323401925 598314068 841884023 28387679 166454723 975772805 448135193 488726970 475593671 612544405 ...
result:
ok 50 numbers
Test #4:
score: 0
Accepted
time: 6ms
memory: 44688kb
input:
99 1 -1 4155 1 0 1361 1 1 5264 2 -2 1903 2 -1 3676 2 0 9643 2 1 6909 2 2 4902 3 -3 3561 3 -2 8489 3 -1 4948 3 0 1282 3 1 3653 3 2 674 3 3 2220 4 -4 5402 4 -3 6923 4 -2 3831 4 -1 9369 4 0 3878 4 1 259 4 2 9008 4 3 2619 4 4 3971 5 -5 3 5 -4 1945 5 -3 9781 5 -2 6504 5 -1 2392 5 0 2685 5 1 5313 5 2 6698...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 222482394 102292681 565355160 333486463 886638230 52090154 281012452 952479247 304932178 295271280 465504333 532380933 466697686 81655090 222769990 649695168 965196638 449484395 193519633 531647625 825384784 972338190 400630002 67150012...
result:
ok 131 numbers
Test #5:
score: 0
Accepted
time: 10ms
memory: 44216kb
input:
99 1 -1 4155 1 0 1361 1 1 5264 2 -2 1903 2 -1 3676 2 0 9643 2 1 6909 2 2 4902 3 -3 3561 3 -2 8489 3 -1 4948 3 0 1282 3 1 3653 3 2 674 3 3 2220 4 -4 5402 4 -3 6923 4 -2 3831 4 -1 9369 4 0 3878 4 1 259 4 2 9008 4 3 2619 4 4 3971 5 -5 3 5 -4 1945 5 -3 9781 5 -2 6504 5 -1 2392 5 0 2685 5 1 5313 5 2 6698...
output:
0 0 0 0 0 0 0 0 0 9347849 942974795 318066180 278731032 587652157 434259249 126876923 16289901 123413264 719603917 254105333 15119937 24263100 889628559 948576022 694493917 964003437 228253365 52984044 254401943 310992697 233279578 253910650 898447558 524407420 957548516 901926896 2245698 91236941 8...
result:
ok 228 numbers
Test #6:
score: 0
Accepted
time: 1ms
memory: 44100kb
input:
99 1 -1 4155 1 0 1361 1 1 5264 2 -2 1903 2 -1 3676 2 0 9643 2 1 6909 2 2 4902 3 -3 3561 3 -2 8489 3 -1 4948 3 0 1282 3 1 3653 3 2 674 3 3 2220 4 -4 5402 4 -3 6923 4 -2 3831 4 -1 9369 4 0 3878 4 1 259 4 2 9008 4 3 2619 4 4 3971 5 -5 3 5 -4 1945 5 -3 9781 5 -2 6504 5 -1 2392 5 0 2685 5 1 5313 5 2 6698...
output:
0 0 0 0 0 0 0 0 0 0 0 823233314 56884775 409561125 803981488 839767063 890265463 385665407 24390958 244235164 479515345 412009151 206386153 128897565 962065073 224758497 357196269 984807250 576030233 223162017 716194180 565496686 166080856 37562000 597023700 855251872 854857206 890776034 760485373 6...
result:
ok 60 numbers
Test #7:
score: 0
Accepted
time: 1ms
memory: 44096kb
input:
1 1 1 1 1 0
output:
1
result:
ok 1 number(s): "1"
Test #8:
score: -100
Runtime Error
input:
99 1 -1 41 1 0 8467 1 1 6334 2 -2 10000 2 -1 9169 2 0 5724 2 1 1478 2 2 9358 3 -3 0 3 -2 4464 3 -1 5705 3 0 8145 3 1 3281 3 2 6827 3 3 9961 4 -4 491 4 -3 2995 4 -2 1942 4 -1 4827 4 0 5436 4 1 2391 4 2 4604 4 3 3902 4 4 153 5 -5 292 5 -4 2382 5 -3 7421 5 -2 8716 5 -1 9718 5 0 9895 5 1 5447 5 2 1726 5...