QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#22518 | #2850. 蛋糕 | blackswallow# | WA | 11ms | 3748kb | C++14 | 1.9kb | 2022-03-09 19:23:26 | 2022-04-30 01:17:28 |
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 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];
unsigned f[20], g[20], C[20][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] = g[i] = 0;
for(int S = 0; S < (1 << 4); ++S) {
unsigned t = 1;
for(int i = 0; i < 4; ++i) {
if((S >> i) & 1) t *= min(2, a[i]);
else t *= a[i];
}
f[popc(S)] += t;
}
for(int i = 0; i < 8; ++i) {
for(int j = i; j < 8; ++j) {
if((j - i) & 1) g[i] -= f[j] * C[j][i];
else g[i] += f[j] * C[j][i];
}
printf("%u ", g[i] & INT_MAX);
}
putchar('\n');
}
signed main () {
#ifdef FILE
freopen(".in", "r", stdin);
freopen(".out", "w", stdout);
#endif
read(T);
for(int i = 0; i < 20; ++i) {
C[i][0] = 1;
for(int j = 1; j <= i; ++j)
C[i][j] = C[i - 1][j] + C[i - 1][j - 1];
}
while(T--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 11ms
memory: 3748kb
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 1574086360 485190476 394708 8 0 0 0 0 325901312 755814656 301172 8 0 0 0 0 1667660544 752197032 372400 8 0 0 0 210762172 120505776 93542516 1370608 16 0 0 0 1455446364 459334168 1882152716 2484832 16 0 0 0 0 0 1714964672 250424 4 0 0 0 645023874 205607214 1456723092 2088456 16 0 0 0 0 15569...
result:
wrong answer 1st lines differ - expected: '0 0 278697304 483210476 394708 8 0 0 0', found: '0 1574086360 485190476 394708 8 0 0 0 '