結果
| 問題 |
No.1490 スライムと爆弾
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-04-23 22:21:13 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,498 bytes |
| コンパイル時間 | 863 ms |
| コンパイル使用メモリ | 93,476 KB |
| 最終ジャッジ日時 | 2025-01-21 00:04:12 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:26:25: error: range-based ‘for’ expression of type ‘std::array<int, 5>’ has incomplete type
26 | for (auto &&j : i) scanf("%d", &j);
| ^
main.cpp:49:14: error: deduced type ‘std::array<int, 5>’ for ‘<structured bindings>’ is incomplete
49 | for(auto [t, u, l, r, a] : slime){
| ^~~~~~~~~~~~~~~
In file included from /usr/include/c++/13/bits/memory_resource.h:47,
from /usr/include/c++/13/string:58,
from /usr/include/c++/13/bits/locale_classes.h:40,
from /usr/include/c++/13/bits/ios_base.h:41,
from /usr/include/c++/13/ios:44,
from /usr/include/c++/13/ostream:40,
from /usr/include/c++/13/iostream:41,
from main.cpp:1:
/usr/include/c++/13/tuple:2019:45: note: declaration of ‘struct std::array<int, 5>’
2019 | template<typename _Tp, size_t _Nm> struct array;
| ^~~~~
In file included from /usr/include/c++/13/string:48:
/usr/include/c++/13/bits/stl_iterator.h: In instantiation of ‘__gnu_cxx::__normal_iterator<_Iterator, _Container>& __gnu_cxx::__normal_iterator<_Iterator, _Container>::operator++() [with _Iterator = std::array<int, 5>*; _Container = std::vector<std::array<int, 5> >]’:
main.cpp:25:21: required from here
/usr/include/c++/13/bits/stl_iterator.h:1111:11: error: cannot increment a pointer to incomplete type ‘std::array<int, 5>’
1111 | ++_M_current;
| ^~~~~~~~~~
In file included from /usr/include/c++/13/vector:66,
from /usr/include/c++/13/queue:63,
from main.cpp:5:
/usr/include/c++/13/bits/stl_vector.h: In instantiation of ‘std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = std::array<int, 5>; _Alloc = std::allocator<std::array<int, 5> >]’:
/usr/include/c++/13/bits/stl_vector.h:557:47
ソースコード
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>
static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;
template<class T> constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;
int main() {
int h, w, n, m;
cin >> h >> w >> n >> m;
h++; w++;
vector<vector<ll>> v(h+1, vector<ll>(w+1, 0));
vector<array<int, 5>> slime(n);
for (auto &&i : slime)
for (auto &&j : i) scanf("%d", &j);
for (int i = 0; i < m; ++i) {
int x, y, b, c;
scanf("%d %d %d %d", &x, &y, &b, &c);
int A = max(0, x-b), B = min(h, x+b+1), C = max(0, y-b), D = min(w, y+b+1);
v[A][C] += c; v[B][C] -= c; v[A][D] -= c; v[B][D] += c;
}
for (int i = 0; i <= h; ++i) {
for (int j = 0; j <= w; ++j) {
if(i) v[i][j] += v[i-1][j];
if(j) v[i][j] += v[i][j-1];
if(i && j) v[i][j] -= v[i-1][j-1];
}
}
for (int i = 0; i <= h; ++i) {
for (int j = 0; j <= w; ++j) {
if(i) v[i][j] += v[i-1][j];
if(j) v[i][j] += v[i][j-1];
if(i && j) v[i][j] -= v[i-1][j-1];
}
}
int ans = 0;
for(auto [t, u, l, r, a] : slime){
t--; l--;
ll val = v[t][l]-v[t][r]-v[u][l]+v[u][r];
if(val < a) ans++;
}
cout << ans << "\n";
return 0;
}