QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#21498 | #2850. 蛋糕 | Skyowo# | AC ✓ | 10ms | 3712kb | C++14 | 1.1kb | 2022-03-07 14:10:25 | 2022-05-08 03:34:00 |
Judging History
answer
// Skyqwq
#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define mp make_pair
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
template <typename T> bool chkMax(T &x, T y) { return (y > x) ? x = y, 1 : 0; }
template <typename T> bool chkMin(T &x, T y) { return (y < x) ? x = y, 1 : 0; }
template <typename T> void inline read(T &x) {
int f = 1; x = 0; char s = getchar();
while (s < '0' || s > '9') { if (s == '-') f = -1; s = getchar(); }
while (s <= '9' && s >= '0') x = x * 10 + (s ^ 48), s = getchar();
x *= f;
}
const LL P = 2148473648ll;
LL a[4], c[9];
void dfs(int u, int s, LL v) {
if (u == 4) {
(c[s] += v) %= P;
return;
}
dfs(u + 1, s + (a[u] == 1) + 1, v);
if (a[u] > 1) dfs(u + 1, s + 1, v);
if (a[u] >= 2) dfs(u + 1, s, v * (a[u] - 2) % P);
}
int main() {
int T; read(T);
while (T--) {
memset(c, 0, sizeof c);
for (int i = 0; i < 4; i++) read(a[i]);
dfs(0, 0, 1);
for (int i = 0; i <= 8; i++)
printf("%lld ", c[i]);
puts("");
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 10ms
memory: 3712kb
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