Skip to content

Commit

Permalink
Merge pull request #96 from NyaanNyaan/fix_bug
Browse files Browse the repository at this point in the history
fix a bug about Issue 95
  • Loading branch information
NyaanNyaan authored Sep 8, 2023
2 parents edfb43e + c026869 commit 198153c
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .verify-helper/timestamps.remote.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"verify/verify-aoj-dsl/aoj-dsl-2-i.test.cpp": "2023-08-10 13:25:59 +0900",
"verify/verify-aoj-dsl/aoj-dsl-3-d-cartesiantree.test.cpp": "2023-08-10 13:25:59 +0900",
"verify/verify-aoj-dsl/aoj-dsl-3-d.test.cpp": "2023-08-10 13:25:59 +0900",
"verify/verify-aoj-dsl/aoj-dsl-5-b-2dseg.test.cpp": "2023-09-08 22:52:34 +0900",
"verify/verify-aoj-dsl/aoj-dsl-5-b-bit2d.test.cpp": "2023-08-10 13:25:59 +0900",
"verify/verify-aoj-dsl/aoj-dsl-5-b.test.cpp": "2023-08-10 13:25:59 +0900",
"verify/verify-aoj-grl/aoj-grl-1-a-fast-dijkstra.test.cpp": "2023-08-10 13:25:59 +0900",
Expand Down Expand Up @@ -58,7 +59,7 @@
"verify/verify-aoj-ntl/aoj-ntl-2-e.test.cpp": "2023-09-05 21:46:27 +0900",
"verify/verify-aoj-ntl/aoj-ntl-2-f.test.cpp": "2023-09-05 21:46:27 +0900",
"verify/verify-aoj-other/aoj-0304.test.cpp": "2023-08-10 13:25:59 +0900",
"verify/verify-aoj-other/aoj-1068.test.cpp": "2023-08-10 14:06:55 +0900",
"verify/verify-aoj-other/aoj-1068.test.cpp": "2023-09-08 22:52:34 +0900",
"verify/verify-aoj-other/aoj-1130-DG-bfs.test.cpp": "2023-08-10 13:25:59 +0900",
"verify/verify-aoj-other/aoj-1377.test.cpp": "2023-09-05 21:46:27 +0900",
"verify/verify-aoj-other/aoj-1613.test.cpp": "2023-08-10 13:25:59 +0900",
Expand Down
2 changes: 1 addition & 1 deletion data-structure-2d/2d-segment-tree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
template <typename T, typename F>
struct SegmentTree2D {
private:
int id(int h, int w) { return h * 2 * W + w; }
int id(int h, int w) const { return h * 2 * W + w; }

public:
int H, W;
Expand Down
32 changes: 32 additions & 0 deletions verify/verify-aoj-dsl/aoj-dsl-5-b-2dseg.test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#define PROBLEM \
"https://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_5_B"
//
#include "../../template/template.hpp"
//
#include "../../data-structure-2d/2d-segment-tree.hpp"
//
using namespace Nyaan;

void q() {
int MAX = TEN(3) + 3;
SegmentTree2D seg(
MAX, MAX, [](int a, int b) { return a + b; }, 0);

ini(N);
rep(i, N) {
ini(a, b, c, d);
seg.update(a, b, seg.get(a, b) + 1);
seg.update(a, d, seg.get(a, d) - 1);
seg.update(c, b, seg.get(c, b) - 1);
seg.update(c, d, seg.get(c, d) + 1);
}
int ans = 0;
rep(i, MAX) rep(j, MAX) amax(ans, seg.query(0, 0, i + 1, j + 1));
out(ans);
}

void Nyaan::solve() {
int t = 1;
// in(t);
while (t--) q();
}

0 comments on commit 198153c

Please sign in to comment.