QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#744259#9627. 算术wjh111WA 13ms3656kbC++981.6kb2024-11-13 21:21:032024-11-13 21:21:06

Judging History

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

  • [2024-11-13 21:21:06]
  • 评测
  • 测评结果:WA
  • 用时:13ms
  • 内存:3656kb
  • [2024-11-13 21:21:03]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long 
const int N=998244353;
int v[109];
struct w{
	int a,b,s,g;
}p[1000];
int r(int a,int b){
	int s=1;
	while (b){
		if (b&1){
			s=(s%N*a%N)%N;
		}
		a=(a%N*a%N)%N;
		b/=2;
	}
	return s;
}
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t,ans,m1,f1,s[13],s1,a[190],g[109],j,i;
	for (i=1;i<=100;i++){
		v[i]=i;
	}
	for (i=1;i<=100;i++){
		for (j=1;j<=i/2;j++){
			v[i]=max(v[i],v[j]*v[i-j]);
		}
		//cout<<v[i]<<" ";
		g[i]=v[i]%N;
	}
	cin>>t;
	v[0]=1;
	s[1]=0;
	while (t--){
		ans=1;
		for (i=1;i<=9;i++){
			cin>>a[i];
		}
		i=2;
		while (a[i]==0){
			i++;
		}
		for (i=2;i<=9;i++){
			s[i]=s[i-1]+a[i];
		}
		if (s[9]==0){
			cout<<g[a[1]]<<"\n";
			continue;
		}
		for (i=0;i<=a[1];i++){
			int i1=i;
			s1=1;
			j=2;
			while (i1>=s[min(j,9ll)]){
				i1-=s[min(j,9ll)];
				j++;
			}
			//cout<<j<<" "<<i1<<" ?";
			s1=s1%N*r(j,s[min(j,9ll)]-i1)%N;
			s1=s1%N*r(j+1,i1)%N;
			//cout<<s1<<" ?";
			p[i].a=a[1]-i;
			if (i1==0){
				p[i].b=j;
				p[i].g=j;
			}
			else{
				p[i].b=j;
				p[i].g=j+1;
			}
			j++;
			for (;j<=9;j++){
				s1=(s1%N*(r(j,a[j])%N))%N;
			}
			//cout<<s1<<"?";
			if ((a[1]-i)<=1){
				s1=(s1+a[1]-i)%N;
			}
			else{
				s1=(s1%N*g[(a[1]-i)]%N)%N;
			}
			p[i].s=s1;
			//if (i>0){
			//	if ((v[p[i].a]*p[i].b)<(v[p[i-1].a]*p[i-1].b)){
				//	break;
			//	}
		//	}
		}
		for (i=1;i<=a[1];i++){
			//cout<<((v[p[i].a]*p[i].g)<(v[p[i-1].a]*p[i-1].b))<<" ";
			if (((v[p[i].a]*p[i].g)<(v[p[i-1].a]*p[i-1].b))==1){
				break;
			}
		}
		cout<<p[i-1].s<<"\n";
	}
} 

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3624kb

input:

7
5 3 0 0 0 0 0 0 0
4 1 1 1 0 0 0 0 0
1 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 1
1 0 0 0 0 0 0 0 2
99 88 77 66 55 44 33 22 11
100 90 80 70 60 50 40 30 20

output:

54
108
1
10
90
90553232
143532368

result:

ok 7 lines

Test #2:

score: -100
Wrong Answer
time: 13ms
memory: 3656kb

input:

1000
22 80 50 23 35 71 81 70 96
40 33 36 2 51 52 96 5 32
56 35 85 13 58 80 26 14 31
60 21 8 19 79 5 94 44 33
85 55 10 59 76 98 28 22 69
14 72 40 14 100 68 5 18 69
95 42 51 0 32 97 37 34 85
54 33 18 40 34 10 72 72 68
81 47 80 23 23 68 40 3 71
58 7 36 79 89 83 5 68 16
30 3 82 79 35 28 30 55 88
17 86 2...

output:

113014030
321820208
765709043
819408880
639261805
241458014
7172464
780360907
240853384
151457742
298466126
259030391
124742738
698195085
493291429
982170221
409158325
951979430
141426731
501117393
440485591
163247072
78098984
910409582
308024444
168349368
423889166
815038086
827159852
914298923
465...

result:

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