QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#744251 | #9627. 算术 | wjh111 | WA | 1ms | 3608kb | C++98 | 1.7kb | 2024-11-13 21:19:47 | 2024-11-13 21:19:49 |
Judging History
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=0;i<=a[1];i++){
cout<<p[i].s<<" ";
}
cout<<"\n";
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<<"\n";
cout<<p[i-1].s<<"\n";
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3608kb
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:
48 48 54 54 37 48 0 0 0 1 54 96 108 96 65 80 0 1 108 1 10 10 0 10 82 90 0 90 432944373 432944373 432944373 861404052 861404052 861404052 469957382 469957382 469957382 778263143 778263143 778263143 2082227 2082227 2082227 626245226 626245226 626245226 454964791 454964791 454964791 636615934 6...
result:
wrong answer 1st lines differ - expected: '54', found: '48 48 54 54 37 48 '