QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#22544 | #2850. 蛋糕 | blackswallow# | AC ✓ | 10ms | 3668kb | C++20 | 1.8kb | 2022-03-09 19:45:28 | 2022-04-30 01:19:31 |
Judging History
answer
//Code By CXY07 - It's My Fiesta.
#include<bits/stdc++.h>
using namespace std;
//#define FILE
#define int long long
#define randint(l, r) (rand() % ((r) - (l) + 1) + (l))
#define abs(x) ((x) < 0 ? (-(x)) : (x))
#define popc(x) __builtin_popcount(x)
#define inv(x) qpow((x), mod - 2)
#define lowbit(x) ((x) & (-(x)))
#define ull unsigned long long
#define pii pair<int, int>
#define LL long long
#define mp make_pair
#define pb push_back
#define scd second
#define vec vector
#define fst first
#define endl '\n'
#define y1 _y1
const int MAXN = 101010;
const int mod = 2148473648;
const int INF = 2e9;
const double eps = 1e-6;
const double PI = acos(-1);
//const int mod = 1e9 + 7;
//const int mod = 998244353;
//const int G = 3;
//const int base = 131;
int T, n, m, a[4];
int f[20];
template<typename T> inline bool read(T &a) {
a = 0; char c = getchar(); int f = 1;
while(c < '0' || c > '9') { if(c == '-') f = -1; c = getchar(); }
while(c >= '0' && c <= '9') { a = a * 10 + (c ^ 48); c = getchar(); }
return a *= f, true;
}
template<typename A, typename ...B>
inline bool read(A &x, B &...y) { return read(x) && read(y...); }
void solve() {
for(int i = 0; i < 4; ++i) read(a[i]);
for(int i = 0; i <= 8; ++i) f[i] = 0;
for(int S = 0; S < (1 << 4); ++S) {
int t = 1, p = 0;
for(int i = 0; i < 4; ++i) {
if((S >> i) & 1) {
(t *= min(2ll, a[i])) %= mod;
if(a[i] == 1) p += 2;
else p += 1;
} else {
if(a[i] > 2) (t *= (a[i] - 2)) %= mod;
else { t = 0; break; }
}
}
(f[p] += t) %= mod;
}
for(int i = 0; i <= 8; ++i) printf("%lld ", (f[i] + mod) % mod);
putchar('\n');
}
signed main () {
#ifdef FILE
freopen(".in", "r", stdin);
freopen(".out", "w", stdout);
#endif
read(T);
while(T--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 10ms
memory: 3668kb
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