QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#21525 | #2850. 蛋糕 | gogo# | WA | 22ms | 3692kb | C++20 | 1.5kb | 2022-03-07 14:32:49 | 2022-05-08 03:35:56 |
Judging History
answer
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = (a); i <= int(b); i ++)
#define per(i, a, b) for(int i = (a); i >= int(b); i --)
#define fi first
#define se second
#define all(s) s.begin(), s.end()
#define trv(i, u, v) for(int i = head[u], v = e[i].to; i; v = e[i = e[i].nxt].to)
#define sz(s) (int)(s.size())
#define lb(s) ((s) & (-s))
#define mk make_pair
#define pb push_back
using namespace std;
typedef __int128 u64;
typedef long long ll;
typedef pair<int,int> P;
template <typename T> bool chkmx(T &x, T y){return x < y ? x = y, true : false;}
template <typename T> bool chkmn(T &x, T y){return x > y ? x = y, true : false;}
template <int T> using A = array<int, T>;
inline u64 read() {
u64 x = 0, f = 1; char c = getchar();
for(; !isdigit(c); c = getchar()) if(c == '-') f = 0;
for(; isdigit(c); c = getchar()) x = x * 10 + c - '0';
return f ? x : -x;
}
const int maxn = 10;
const u64 mod = 2148473648ll;
u64 a[maxn + 5], f[maxn + 5], g[maxn + 5];
int n;
void solve() {
n = 4;
rep(i, 1, n) a[i] = read();
memset(f, 0, sizeof f);
f[0] = 1;
rep(i, 1, n) {
swap(f, g);
memset(f, 0, sizeof f);
u64 x = a[i] == 1 ? 0 : (a[i] - 2), y = 2 - (a[i] == 1);
rep(j, 0, 2 * i) {
f[j] = (g[j] * x % mod + g[j - 1 - (a[i] == 1)] * y % mod) % mod;
}
}
rep(i, 0, 8) cout << (ll)f[i] << " \n"[i == 8];
}
int main() {
// freopen("in.txt", "r", stdin);
for(int T = read(); T; T --) {
solve();
}
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 22ms
memory: 3692kb
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:
54768 8 278697304 483210476 394708 8 0 0 0 652442240 210408 939058624 754824656 301172 8 0 0 0 4 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 4 0 4 0 1713974672 250424 4 0 0 1222501394 1134629934 1413163092 ...
result:
wrong answer 1st lines differ - expected: '0 0 278697304 483210476 394708 8 0 0 0', found: '54768 8 278697304 483210476 394708 8 0 0 0'