QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#656051#5169. 夹娃娃Butanlishi0 1138ms3888kbC++142.0kb2024-10-19 11:04:282024-10-19 11:04:29

Judging History

你现在查看的是最新测评结果

  • [2024-10-19 11:04:29]
  • 评测
  • 测评结果:0
  • 用时:1138ms
  • 内存:3888kb
  • [2024-10-19 11:04:28]
  • 提交

answer

#include<bits/stdc++.h>
#define ld long double
#define ci const int 
#define ll long long
#define fo(i,l,r) for(int i=(l);i<=(r);++i)
#define fu(i,l,r) for(int i=(l);i<(r);++i)
#define fd(i,l,r) for(int i=(l);i>=(r);--i)
#define P(x) __builtin_popcount(x)
#define gcd(x,y) __gcd(x,y)
using namespace std;
ci mod=998244353,N=1e6+5;
const ld eps=1e-9;
void _(int &a,int b){a=(a+b)%mod;}
mt19937 rad(chrono::steady_clock::now().time_since_epoch().count());
inline ll read(){ll u=0,f=1;char o;while((o=getchar())<48||o>57)if(o=='-')f=-1;u=(o^48);while((o=getchar())>=48&&o<=57)u=(u<<1)+(u<<3)+(o^48);return u*f;}
void write(ll x){if(x<0)putchar('-'),x=-x;if(x>9)write(x/10);putchar(x%10+48);}
bool ST;
int n,q,a[16];
int b[16][550],c[16][550];
namespace solve4
{
	int f[16][525],qz[525];
	char ch[N];
	bool ty[N];
	int main()
	{
		while(q--)
		{
			scanf("%s",ch+1);
			ll m=read(),k=read();
			memset(f,0,sizeof(f));
			f[0][0]=1;
			bool F=0;
			fo(i,1,n)
			{
				ty[i]=ch[i]-'0';
				ll num=c[i][1];
				if(ty[i])
				{
					if(b[i][1]*c[i][1]<k)
					{
						F=1;
						break;
					}
					ll up=(k+b[i][1]-1)/b[i][1];
					m-=up*b[i][1];
					if(m<0)break;
					num-=c[i][1];
				}
//				cout<<'<<b[i][1]<<' '<<num<<'\n';
//				fo(j,0,m)cout<<f[i-1][j]<<' ';cout<<'\n';
				fo(j,0,m)
				{
					qz[j]=f[i-1][j];
					if(j>=b[i][1])_(qz[j],qz[j-b[i][1]]);
					f[i][j]=qz[j];
					if(j>=b[i][1]*(num+1))_(f[i][j],-qz[j-b[i][1]*(num+1)]);
				}
			}
			int ans=0;
			if(!F&&m>=0)
			{
				fo(i,0,m)_(ans,f[n][i]);
			}
			cout<<(ans+mod)%mod<<'\n';
		}
		return 0;
	}
}
bool ED;
signed main()
{//cerr<<(&ST-&ED)/1048576.0<<'\n';
//	freopen("1.in","r",stdin);
//	freopen("1.out","w",stdout);
//	freopen("doll.in","r",stdin);
//	freopen("doll.out","w",stdout);
	n=read();q=read();read();
	bool F=0;
	fo(i,1,n)
	{
		a[i]=read();
		fo(j,1,a[i])b[i][j]=read(),c[i][j]=read();
		if(a[i]!=1)F=1;
	}
	if(!F)return solve4::main();
/*	while(q--)
	{
		
	}*/
}

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3624kb

input:

1 521 998244353
39 520 520 11 22 414 8 95 18 229 356 26 407 316 10 24 26 19 61 11 130 482 476 420 15 192 193 208 24 19 233 494 217 275 294 26 28 439 20 272 277 28 198 5 335 22 8 28 17 154 78 6 13 175 17 2 5 477 256 200 4 1 36 427 371 439 23 10 65 426 25 24 27 121 29 28 13 12 453
0 520 1
1 519 1
1 51...

output:


result:

wrong answer 1st lines differ - expected: '38813347', found: ''

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Wrong Answer

Test #9:

score: 0
Wrong Answer
time: 1138ms
memory: 3888kb

input:

15 52099 998244353
1 9 3
1 9 4
1 9 2
1 8 10
1 4 4
1 3 1
1 2 5
1 4 9
1 1 4
1 9 4
1 7 6
1 1 6
1 2 5
1 5 2
1 3 5
101000000001010 516 1
010001001010101 520 2
000000101000001 519 2
101011111100011 518 1
010110001000111 520 2
000110111100111 516 1
000100101001011 519 3
000111001010011 518 1
00001110010111...

output:

207900000
4158000
291060000
16170
352800
5880
1260000
756000
231000
4410000
288750
31500
4536000
66
831600
472500
151200
37800
2160
32400
69300
378000
2100
363825000
16800
8820000
15120
462000
750
67500
157500
113400
15
25200
252
57750
10395000
9000
26400
420000
161700
1617000
1188000
150000
106920
...

result:

wrong answer 1st lines differ - expected: '993379058', found: '207900000'

Subtask #5:

score: 0
Skipped

Dependency #3:

0%

Subtask #6:

score: 0
Skipped

Dependency #4:

0%

Subtask #7:

score: 0
Skipped

Dependency #6:

0%