QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#21523 | #2850. 蛋糕 | gsh# | WA | 6ms | 3624kb | C++20 | 1.1kb | 2022-03-07 14:32:15 | 2022-05-08 03:35:51 |
Judging History
answer
#include<algorithm>
#include<iostream>
#include<vector>
#include<cstdio>
using namespace std;
#define int long long
#define For(i,l,r) for(int i=l;i<=r;i++)
#define FOR(i,l,r) for(int i=l;i>=r;i--)
#define P 2148473648
#define MAXN 100001
int get(){int x=0,f=1;char c=getchar();while(c<'0'||c>'9')c=='-'&&(f=-1),c=getchar();while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();return x*f;}
signed main()
{
int T=get();
while(T--)
{
int a[4];For(i,0,3)a[i]=get();int ans[8];For(i,0,4)ans[i]=0;vector<int>b;
int mul=1;For(i,0,3)if(a[i]<=2)mul*=2;
int cnt=0;For(i,0,3)if(a[i]==1)cnt+=2;else if(a[i]==2)cnt+=1;else b.push_back(a[i]);
if(!b.size()){For(i,1,cnt-1)cout<<"0 ";int ans=1;For(i,0,3)ans*=a[i];cout<<ans<<' ';For(i,1,8-cnt)cout<<"0 ";cout<<'\n';continue;}
int res[5]={1,0,0,0,0};
for(auto i:b)
{
int tmp[5];For(j,0,4)tmp[j]=res[j]*(i-2)%P;For(j,1,4)tmp[j]=(tmp[j]+res[j-1]*2)%P;
For(j,0,4)res[j]=tmp[j];
}
For(i,1,cnt)cout<<"0 ";For(j,0,b.size())cout<<res[j]*mul%P<<' ';For(j,0,7-cnt-b.size())cout<<"0 ";cout<<'\n';
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 6ms
memory: 3624kb
input:
9999 18429 66560 1 13694 48994 1 16287 10018 26028 52162 14916 1 30285 52396 33384 55269 65461 96967 74820 73364 55054 70162 1 1 97285 88897 39444 35439 61069 20048 35664 1 21838 22945 6244 79240 46316 82624 33318 31522 90387 93765 7568 97379 22273 74037 1255 91257 67961 28295 1 36263 20958 87638 59...
output:
0 0 557394608 966420952 789416 16 0 0 0 0 0 1878117216 1509649312 602344 16 0 0 0 0 0 1857650272 1500434064 744800 16 0 0 0 1239780156 506705424 73742516 1370608 16 0 0 0 0 1867092428 2145345144 1816812716 2484832 16 0 0 0 0 0 0 0 0 410477744 1001696 16 0 0 1222501394 1134629934 1413163092 208...
result:
wrong answer 1st lines differ - expected: '0 0 278697304 483210476 394708 8 0 0 0', found: '0 0 557394608 966420952 789416 16 0 0 0 '