QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#570291 | #9240. Mosaic | liuziao | 0 | 32ms | 11628kb | C++23 | 1.1kb | 2024-09-17 15:11:25 | 2024-09-17 15:11:29 |
Judging History
answer
#include "mosaic.h"
#include <bits/stdc++.h>
const int kMaxN = 2e5 + 5;
int n, a[kMaxN], b[kMaxN];
int cnt[5005][5005];
void prework() {
for (int i = 1; i <= n; ++i) {
cnt[1][i] = a[i], cnt[i][1] = b[i];
}
for (int i = 2; i <= n; ++i)
for (int j = 2; j <= n; ++j)
cnt[i][j] = (!cnt[i - 1][j] && !cnt[i][j - 1]);
for (int i = 1; i <= n; ++i)
for (int j = 1; j <= n; ++j)
cnt[i][j] += cnt[i][j - 1] + cnt[i - 1][j] - cnt[i - 1][j - 1];
}
int64_t query(int x, int y) {
return cnt[x][y];
}
std::vector<long long> mosaic(std::vector<int> X, std::vector<int> Y,
std::vector<int> T, std::vector<int> B,
std::vector<int> L, std::vector<int> R) {
n = (int)X.size();
for (int i = 1; i <= n; ++i) {
a[i] = X[i - 1], b[i] = Y[i - 1];
}
prework();
std::vector<long long> vec;
for (int i = 0; i < (int)T.size(); ++i) {
vec.emplace_back(query(B[i] + 1, R[i] + 1) - query(T[i], R[i] + 1) - query(B[i] + 1, L[i]) + query(L[i], R[i]));
}
return vec;
}
详细
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 5
Accepted
time: 1ms
memory: 6140kb
input:
njJ9Z7VxxKGR6SUcJMgdzy3qMz4JZ1Tq 1 0 0 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
output:
Wm5rkGNobnYjFI7TIY17RAm6FAQ2LlO9 OK 0 0 0 0 0 0 0 0 0 0
result:
ok
Test #2:
score: 5
Accepted
time: 1ms
memory: 5940kb
input:
njJ9Z7VxxKGR6SUcJMgdzy3qMz4JZ1Tq 1 1 1 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
output:
Wm5rkGNobnYjFI7TIY17RAm6FAQ2LlO9 OK 1 1 1 1 1 1 1 1 1 1
result:
ok
Test #3:
score: 0
Wrong Answer
time: 0ms
memory: 3844kb
input:
njJ9Z7VxxKGR6SUcJMgdzy3qMz4JZ1Tq 2 1 0 1 0 10 1 1 0 1 1 1 0 1 0 0 0 0 0 1 0 1 0 1 0 1 1 1 0 0 0 1 0 1 0 1 1 1 1 1 0 1 0 0 0 1
output:
Wm5rkGNobnYjFI7TIY17RAm6FAQ2LlO9 OK 1 1 1 2 2 0 2 2 1 1
result:
wrong answer 10th lines differ - on the 1st token, expected: '1', found: '2'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Runtime Error
Test #18:
score: 0
Runtime Error
input:
njJ9Z7VxxKGR6SUcJMgdzy3qMz4JZ1Tq 199999 0 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 0 0 0 1 0 0 0 0 1 1 1 0 1 0 0 0 1 0 1 1 0 1 1 1 0 1 0 0 1 1 0 1 1 0 0 0 1 1 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 1 0 1 1 1 1 1 0 0 0 1 0 0 0 0 1 0 0 0 1 1 1 1 0 1 0 1 1 1 0 1 0 1 0 0 0 1 1 1 1 0 0 0 1 1 1 1 0 1 0 1 1 0 0 0 0 ...
output:
result:
Subtask #4:
score: 0
Skipped
Dependency #2:
0%
Subtask #5:
score: 0
Wrong Answer
Test #31:
score: 0
Wrong Answer
time: 32ms
memory: 11628kb
input:
njJ9Z7VxxKGR6SUcJMgdzy3qMz4JZ1Tq 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 200000 1 7 0 4 3 4 3 4 3 6 2 5 4 5 6 7 5 7 2 8 0 6 4 7 0 5 6 7 1 3 9 9 6 9 1 7 2 9 4 6 4 4 6 7 0 1 8 8 7 7 0 3 0 4 1 7 2 2 0 9 3 9 4 6 3 9 0 9 1 8 4 6 4 5 5 7 0 6 2 3 2 3 0 6 1 9 8 8 2 4 3 4 3 6 2 9 3 9 2 7 1 3 0 3 0 8 2 4 3...
output:
Wm5rkGNobnYjFI7TIY17RAm6FAQ2LlO9 OK 14 3 9 9 12 21 20 34 14 18 8 25 2 14 4 15 32 20 9 7 6 29 5 19 23 5 14 9 7 19 12 18 7 3 6 15 21 6 6 8 15 24 16 4 13 8 28 27 17 12 13 19 23 -4 1 5 14 29 5 4 4 16 6 4 24 32 10 0 7 22 7 12 19 31 4 25 15 6 5 16 10 13 14 3 5 12 21 1 2 5 10 14 28 14 10 -2 27 6 17 30 24 9...
result:
wrong answer 4th lines differ - on the 1st token, expected: '2', found: '3'
Subtask #6:
score: 0
Runtime Error
Test #42:
score: 0
Runtime Error
input:
njJ9Z7VxxKGR6SUcJMgdzy3qMz4JZ1Tq 199999 0 1 0 0 0 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 0 0 0 1 1 0 1 0 1 1 0 0 1 0 1 0 1 0 1 0 1 0 0 1 0 1 0 1 1 0 0 1 1 1 1 1 0 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1 1 1 0 0 1 1 1 1 0 1 0 0 0 0 0 1 1 1 0 1 1 0 1 1 0 0 1 1 0 0 0 0 1 0 1 ...
output:
result:
Subtask #7:
score: 0
Skipped
Dependency #3:
0%
Subtask #8:
score: 0
Skipped
Dependency #1:
0%