QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#21502#2850. 蛋糕Mr_Eight#AC ✓3ms3652kbC++142.3kb2022-03-07 14:14:292022-05-08 03:34:14

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-05-08 03:34:14]
  • 评测
  • 测评结果:AC
  • 用时:3ms
  • 内存:3652kb
  • [2022-03-07 14:14:29]
  • 提交

answer

//#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <math.h>
#include <cmath>
#include <algorithm>
#include <climits>
#include <functional>
#include <cstring>
#include <string>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <complex>
#include <random>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define itn int
#define nit int
#define ll long long
#define ms multiset
#define F(i,a,b) for(register int i=a,i##end=b;i<=i##end;++i)
#define UF(i,a,b) for(register int i=a,i##end=b;i>=i##end;--i)
#define re register
#define ri re int
#define il inline
#define pii pair<int,int>
#define cp complex<double>
//#pra gma G CC opti mize(3)
using namespace std;
using std::bitset;
//using namespace __gnu_pbds;
const double Pi=acos(-1);
namespace fastIO {
	template<class T>
	inline void read(T &x) {
		x=0;
		bool fu=0;
		char ch=0;
		while(ch>'9'||ch<'0') {
			ch=getchar();
			if(ch=='-')fu=1;
		}
		while(ch<='9'&&ch>='0') x=(x*10-48+ch),ch=getchar();
		if(fu)x=-x;
	}
	inline int read() {
		int x=0;
		bool fu=0;
		char ch=0;
		while(ch>'9'||ch<'0') {
			ch=getchar();
			if(ch=='-')fu=1;
		}
		while(ch<='9'&&ch>='0') x=(x*10-48+ch),ch=getchar();
		return fu?-x:x;
	}
	template<class T,class... Args>
	inline void read(T& t,Args&... args) {
		read(t);
		read(args...);
	}
	char _n_u_m_[40];
	template<class T>
	inline void write(T x ) {
		if(x==0){
			putchar('0');
			return;
		}
		T tmp = x > 0 ? x : -x ;
		if( x < 0 ) putchar('-') ;
		register int cnt = 0 ;
		while( tmp > 0 ) {
			_n_u_m_[ cnt ++ ] = tmp % 10 + '0' ;
			tmp /= 10 ;
		}
		while( cnt > 0 ) putchar(_n_u_m_[ -- cnt ]) ;
	}
	template<class T>
	inline void write(T x ,char ch) {
		write(x);
		putchar(ch);
	}
}
using namespace fastIO;
#define mod 2148473648ll
ll ans[9],x[5];
inline void dfs(int pos,int now,ll v){
	if(pos==5){
		ans[now]=(ans[now]+v)%mod;return;
	}
	if(x[pos]==1)dfs(pos+1,now+2,v);
	else dfs(pos+1,now+1,v*2%mod),dfs(pos+1,now,v*(x[pos]-2)%mod);
}
int main(){
	F(sadf,1,read()){
		memset(ans,0,sizeof(ans));
		F(i,1,4)read(x[i]);
		dfs(1,0,1);
		F(i,0,8)write(ans[i],' ');puts("");
	}
    return 0;
}


Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 3652kb

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 278697304 483210476 394708 8 0 0 0 
0 0 939058608 754824656 301172 8 0 0 0 
0 0 928825136 750217032 372400 8 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 1713974672 250424 4 0 0 
1222501394 1134629934 1413163092 2088456 16 ...

result:

ok 9999 lines