QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#765805 | #8049. Equal Sums | guosoun | Compile Error | / | / | C++17 | 1.3kb | 2024-11-20 15:19:17 | 2024-11-20 15:19:18 |
Judging History
This is the latest submission verdict.
- [2024-11-20 15:19:18]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-11-20 15:19:17]
- Submitted
answer
#include <bits/stdc++.h>
using ll = long long;
const int mod = 998244353;
int main() {
std::cin.tie(0)->sync_with_stdio(0);
const int MAXV = 500;
int n, m;
std::cin >> n >> m;
std::vector<std::pair<int, int>> vx(n), vy(m);
for (auto &[l, r] : vx) std::cin >> l >> r;
for (auto &[l, r] : vy) std::cin >> l >> r;
std::vector<std::array<int, 2 * MAXV + 2>> dp(m + 1);
dp[0][MAXV] = 1;
dp[0][MAXV + 1] = -1;
for (int i = 0; i <= n; i++) {
std::vector<std::array<int, 2 * MAXV + 1>> nxt(m + 1);
for (int j = 0; j <= m; j++) {
for (int v = 1; v <= MAXV * 2; v++) (dp[j][v] += dp[j][v - 1]) %= mod;
if (i < n) {
auto [li, ri] = vx[i];
for (int v = -MAXV; v <= 0; v++) {
(nxt[j][v + li + MAXV] += dp[j][v + MAXV]) %= mod;
(nxt[j][v + ri + MAXV + 1] -= dp[j][v + MAXV]) %= mod;
}
}
if (j < m) {
auto [lj, rj] = vy[j];
for (int v = 1; v <= MAXV; v++) {
(dp[j + 1][v - rj + MAXV] += dp[j][v + MAXV]) %= mod;
(dp[j + 1][v - lj + MAXV + 1] -= dp[j][v + MAXV]) %= mod;
}
}
}
if (i) {
for (int j = 1; j <= m; j++) std::cout << (dp[j][MAXV] + mod) % mod << ' ';
std::cout << '\n';
}
dp = nxt;
}
}
详细
answer.code: In function ‘int main()’: answer.code:39:10: error: no match for ‘operator=’ (operand types are ‘std::vector<std::array<int, 1002> >’ and ‘std::vector<std::array<int, 1001> >’) 39 | dp = nxt; | ^~~ In file included from /usr/include/c++/13/vector:72, from /usr/include/c++/13/functional:64, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:53, from answer.code:1: /usr/include/c++/13/bits/vector.tcc:210:5: note: candidate: ‘std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = std::array<int, 1002>; _Alloc = std::allocator<std::array<int, 1002> >]’ 210 | vector<_Tp, _Alloc>:: | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/13/bits/vector.tcc:211:42: note: no known conversion for argument 1 from ‘std::vector<std::array<int, 1001> >’ to ‘const std::vector<std::array<int, 1002> >&’ 211 | operator=(const vector<_Tp, _Alloc>& __x) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ In file included from /usr/include/c++/13/vector:66: /usr/include/c++/13/bits/stl_vector.h:763:7: note: candidate: ‘std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = std::array<int, 1002>; _Alloc = std::allocator<std::array<int, 1002> >]’ 763 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) | ^~~~~~~~ /usr/include/c++/13/bits/stl_vector.h:763:26: note: no known conversion for argument 1 from ‘std::vector<std::array<int, 1001> >’ to ‘std::vector<std::array<int, 1002> >&&’ 763 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) | ~~~~~~~~~^~~ /usr/include/c++/13/bits/stl_vector.h:785:7: note: candidate: ‘std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = std::array<int, 1002>; _Alloc = std::allocator<std::array<int, 1002> >]’ 785 | operator=(initializer_list<value_type> __l) | ^~~~~~~~ /usr/include/c++/13/bits/stl_vector.h:785:46: note: no known conversion for argument 1 from ‘std::vector<std::array<int, 1001> >’ to ‘std::initializer_list<std::array<int, 1002> >’ 785 | operator=(initializer_list<value_type> __l) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~