QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#301227 | #4922. 生活在对角线下 | zyc070419 | 0 | 2ms | 7512kb | C++14 | 2.1kb | 2024-01-09 16:11:49 | 2024-01-09 16:11:50 |
answer
#include <bits/stdc++.h>
#define PII pair<int, int>
using namespace std;
const int N = 1e5 + 3;
const int mod = 998244353;
inline int add(int x, int y) {x += y; return x >= mod ? x - mod : x;}
inline int del(int x, int y) {x -= y; return x < 0 ? x + mod : x;}
inline void Add(int &x, int y) {x = add(x, y);}
inline void Del(int &x, int y) {x = del(x, y);}
inline int read() {
char ch = getchar(); int x = 0;
while (!isdigit(ch)) {ch = getchar();}
while (isdigit(ch)) {x = (x << 3) + (x << 1) + ch - 48; ch = getchar();}
return x;
}
int T, c, p, q, L, cnt, pos[10][10], pw[N][10];
PII id[10];
inline int calc(int x, int y, int k) {return 1ll * pw[x][id[k].first] * pw[y][id[k].second] % mod;}
namespace subtask1 {
const int N1 = 1005;
int f[N1][N1], g[N1][N1][10];
bool check() {return L <= 1000;}
void solve() {
f[0][0] = 1;
for (int i = 0; i < cnt; ++i) g[0][0][i] = calc(0, 0, i);
for (int i = 0; i <= L; ++i)
for (int j = 0; j <= L; ++j) {
if (i == 0 && j == 0) continue;
if (i) Add(f[i][j], f[i - 1][j]);
if (j) Add(f[i][j], f[i][j - 1]);
for (int k = 0; k < cnt; ++k) {
if (i) Add(g[i][j][k], g[i - 1][j][k]);
if (j) Add(g[i][j][k], g[i][j - 1][k]);
if (j <= i) Add(g[i][j][k], 1ll * f[i][j] * calc(i, j, k) % mod);
}
}
int n, m, ans;
while (T--) {
n = read(); m = read(); ans = 0;
for (int i = 0; i < cnt; ++i) Add(ans, 1ll * g[n][m][i] * read() % mod);
printf("%d\n", ans);
}
}
}
int main() {
T = read(); c = read(); p = read(); q = read(); L = read(); L = max(L, L + c);
for (int i = 0; i <= p; ++i)
for (int j = 0; j <= q; ++j)
id[pos[i][j] = cnt++] = make_pair(i, j);
for (int i = 0; i <= L; ++i) {
pw[i][0] = 1;
for (int j = 1; j <= max(p, q); ++j) pw[i][j] = 1ll * pw[i][j - 1] * i % mod;
}
if (subtask1 :: check()) subtask1 :: solve();
return 0;
}
详细
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3536kb
input:
1 -10 1 2 1000 825 815 107973512 400177523 812303207 164088430 603506669 337780072
output:
result:
wrong answer Answer contains longer sequence [length = 1], but output contains 0 elements
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Wrong Answer
Test #9:
score: 0
Wrong Answer
time: 2ms
memory: 7512kb
input:
1 4683 0 0 95317 86560 91243 412303217
output:
result:
wrong answer Answer contains longer sequence [length = 1], but output contains 0 elements
Subtask #4:
score: 0
Skipped
Dependency #3:
0%
Subtask #5:
score: 0
Skipped
Dependency #1:
0%
Subtask #6:
score: 0
Wrong Answer
Test #41:
score: 0
Wrong Answer
time: 2ms
memory: 7348kb
input:
100000 0 2 1 100000 48964 48964 666670967 90494987 74847122 615108201 29533064 582540229 14418 14418 391779909 223696706 701170191 885097597 551643398 25626747 81584 81584 951326734 520293397 13860946 896899117 821166399 282263457 76849 76849 598606953 879771697 930252135 671750715 673503431 3060699...
output:
result:
wrong answer Answer contains longer sequence [length = 100000], but output contains 0 elements
Subtask #7:
score: 0
Skipped
Dependency #1:
0%