QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#66320 | #5014. 复读程度 | czxb2 | 0 | 62ms | 16016kb | C++14 | 1.1kb | 2022-12-08 11:42:04 | 2022-12-08 11:42:07 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#ifdef ONLINE_JUDGE
#define freopen(...) 0
#endif
using ul = unsigned long long;
using ll = long long;
using l3 = __int128_t;
const int N = 5100;
const ul M = 1000000007ll * 1000000009;
#define IO(a) freopen(#a".in", "r", stdin), freopen(#a".out", "w", stdout),\
cin.tie(0)->sync_with_stdio(0), cout.tie(0)
#define F(i, a, b) for (int i = (a), iee = (b); i <= iee; i++)
int n, q;
char s[N];
ul wl[N], wr[N], w[N][N];
ul a[N][N];
unordered_map<ul, ul> sl, sr;
int main() {
IO(b);
cin >> n >> q >> s + 1;
assert(n <= 5000 && q <= 5000);
F(i, 1, n) cin >> wl[i];
F(i, 1, n) cin >> wr[i];
F(i, 1, n) F(j, i, n) a[i][j] = ((l3)a[i][j - 1] * 1145141919810ll + s[j]) % M;
F(i, 1, n) F(j, i, n) sl[a[i][j]] += wl[i], sr[a[i][j]] += wr[i];
F(i, 1, n) F(j, i, n) w[i][j] = sl[a[i][j]] * sr[a[i][j]];
F(i, 1, q) {
int l1, r1, l2, r2;
ul ans = 0;
cin >> l1 >> r1 >> l2 >> r2;
int s1 = r1 - l1, s2 = r2 - l2, len = max(s1, s2);
F(i, 1, n - len) if (a[i][i + s1] == a[l1][r1])
F(j, i + len, n) if (a[j - s2][j] == a[l2][r2])
ans += w[i][j];
cout << ans << "\n";
}
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 62ms
memory: 16016kb
input:
500 500 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
14705470963471828566 9404691893886808658 7876477827418776621 4911997747130591098 12459266956655437694 2382215352625272250 17634555486692251432 2829840596683947526 2359370660838595792 11133070212851528303 10992035823474992344 9604012687255557613 17249373044636030184 15281763373596781575 5032378067398...
result:
wrong answer 1st lines differ - expected: '15720454042420499810', found: '14705470963471828566'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Skipped
Dependency #2:
0%
Subtask #4:
score: 0
Dangerous Syscalls
Test #22:
score: 0
Dangerous Syscalls
input:
100000 100000 zbbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbabaababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaababbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbabaababbaabbabaababbabaabbaabab...
output:
result:
Subtask #5:
score: 0
Skipped
Dependency #4:
0%
Subtask #6:
score: 0
Skipped
Dependency #2:
0%
Subtask #7:
score: 0
Skipped
Dependency #3:
0%