Datasets:
Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- problems/PA-03/Atcoder/abc211_f/data/10.out +0 -0
- problems/PA-03/Atcoder/abc211_f/data/11.out +0 -0
- problems/PA-03/Atcoder/abc211_f/data/15.in +0 -0
- problems/PA-03/Atcoder/abc211_f/data/15.out +0 -0
- problems/PA-03/Atcoder/abc211_f/data/16.out +0 -0
- problems/PA-03/Atcoder/abc211_f/data/19.in +0 -0
- problems/PA-03/Atcoder/abc211_f/data/2.in +11 -0
- problems/PA-03/Atcoder/abc211_f/data/20.out +0 -0
- problems/PA-03/Atcoder/abc211_f/data/21.out +0 -0
- problems/PA-03/Atcoder/abc211_f/data/24.in +0 -0
- problems/PA-03/Atcoder/abc211_f/data/25.out +0 -0
- problems/PA-03/Atcoder/abc211_f/data/26.out +0 -0
- problems/PA-03/Atcoder/abc211_f/data/28.in +0 -0
- problems/PA-03/Atcoder/abc211_f/data/29.in +0 -0
- problems/PA-03/Atcoder/abc211_f/data/30.out +0 -0
- problems/PA-03/Atcoder/abc211_f/data/31.out +0 -0
- problems/PA-03/Atcoder/abc211_f/data/34.in +0 -0
- problems/PA-03/Atcoder/abc211_f/data/34.out +0 -0
- problems/PA-03/Atcoder/abc211_f/data/35.out +0 -0
- problems/PA-03/Atcoder/abc211_f/data/36.out +0 -0
- problems/PA-03/Atcoder/abc211_f/data/38.in +0 -0
- problems/PA-03/Atcoder/abc211_f/data/4.out +4 -0
- problems/PA-03/Atcoder/abc211_f/data/40.out +0 -0
- problems/PA-03/Atcoder/abc211_f/data/9.in +0 -0
- problems/PA-03/Atcoder/abc211_f/editorial.md +27 -0
- problems/PA-03/Atcoder/abc211_f/judge.json +15 -0
- problems/PA-03/Atcoder/abc211_f/meta.json +16 -0
- problems/PA-03/Atcoder/abc211_f/solution.cpp +94 -0
- problems/PA-03/Atcoder/abc211_f/statement.md +106 -0
- problems/PA-03/Atcoder/abc231_f/data/1.in +3 -0
- problems/PA-03/Atcoder/abc231_f/data/1.out +1 -0
- problems/PA-03/Atcoder/abc231_f/data/10.in +0 -0
- problems/PA-03/Atcoder/abc231_f/data/10.out +1 -0
- problems/PA-03/Atcoder/abc231_f/data/11.in +0 -0
- problems/PA-03/Atcoder/abc231_f/data/11.out +1 -0
- problems/PA-03/Atcoder/abc231_f/data/12.in +0 -0
- problems/PA-03/Atcoder/abc231_f/data/12.out +1 -0
- problems/PA-03/Atcoder/abc231_f/data/13.in +0 -0
- problems/PA-03/Atcoder/abc231_f/data/13.out +1 -0
- problems/PA-03/Atcoder/abc231_f/data/14.in +0 -0
- problems/PA-03/Atcoder/abc231_f/data/14.out +1 -0
- problems/PA-03/Atcoder/abc231_f/data/15.in +0 -0
- problems/PA-03/Atcoder/abc231_f/data/15.out +1 -0
- problems/PA-03/Atcoder/abc231_f/data/16.in +0 -0
- problems/PA-03/Atcoder/abc231_f/data/16.out +1 -0
- problems/PA-03/Atcoder/abc231_f/data/17.in +0 -0
- problems/PA-03/Atcoder/abc231_f/data/17.out +1 -0
- problems/PA-03/Atcoder/abc231_f/data/18.in +0 -0
- problems/PA-03/Atcoder/abc231_f/data/18.out +1 -0
- problems/PA-03/Atcoder/abc231_f/data/19.in +0 -0
problems/PA-03/Atcoder/abc211_f/data/10.out
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
problems/PA-03/Atcoder/abc211_f/data/11.out
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
problems/PA-03/Atcoder/abc211_f/data/15.in
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
problems/PA-03/Atcoder/abc211_f/data/15.out
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
problems/PA-03/Atcoder/abc211_f/data/16.out
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
problems/PA-03/Atcoder/abc211_f/data/19.in
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
problems/PA-03/Atcoder/abc211_f/data/2.in
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
3
|
| 2 |
+
4
|
| 3 |
+
1 2 1 4 3 4 3 2
|
| 4 |
+
4
|
| 5 |
+
2 5 2 3 5 3 5 5
|
| 6 |
+
4
|
| 7 |
+
5 6 5 5 3 5 3 6
|
| 8 |
+
3
|
| 9 |
+
1 4
|
| 10 |
+
2 3
|
| 11 |
+
4 5
|
problems/PA-03/Atcoder/abc211_f/data/20.out
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
problems/PA-03/Atcoder/abc211_f/data/21.out
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
problems/PA-03/Atcoder/abc211_f/data/24.in
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
problems/PA-03/Atcoder/abc211_f/data/25.out
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
problems/PA-03/Atcoder/abc211_f/data/26.out
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
problems/PA-03/Atcoder/abc211_f/data/28.in
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
problems/PA-03/Atcoder/abc211_f/data/29.in
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
problems/PA-03/Atcoder/abc211_f/data/30.out
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
problems/PA-03/Atcoder/abc211_f/data/31.out
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
problems/PA-03/Atcoder/abc211_f/data/34.in
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
problems/PA-03/Atcoder/abc211_f/data/34.out
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
problems/PA-03/Atcoder/abc211_f/data/35.out
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
problems/PA-03/Atcoder/abc211_f/data/36.out
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
problems/PA-03/Atcoder/abc211_f/data/38.in
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
problems/PA-03/Atcoder/abc211_f/data/4.out
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
0
|
| 2 |
+
2
|
| 3 |
+
1
|
| 4 |
+
1
|
problems/PA-03/Atcoder/abc211_f/data/40.out
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
problems/PA-03/Atcoder/abc211_f/data/9.in
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
problems/PA-03/Atcoder/abc211_f/editorial.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# F - Rectilinear Polygons (editorial)
|
| 2 |
+
|
| 3 |
+
Source: https://atcoder.jp/contests/abc211/editorial/2333 by en_translator
|
| 4 |
+
|
| 5 |
+
Hint
|
| 6 |
+
|
| 7 |
+
Did you consider \(N = 1\)?
|
| 8 |
+
Generally, when choosing a solution, it is necessary that it solves the problem with weaker constraints.
|
| 9 |
+
|
| 10 |
+
Solution
|
| 11 |
+
|
| 12 |
+
Let’s first consider \(N=1\).
|
| 13 |
+
We scan in the increasing order of \(x\) and manage if each \(y\) coordinate is included in the polygon.
|
| 14 |
+
We only focus on those edges of the polygon parallel to the \(y\) axis, and inspect them in the increasing order of their \(x\) coordinates.
|
| 15 |
+
For any edge with endpoints \((X, Y_1)\) and \((X, Y_2) (Y_1 \lt Y_2)\), this edge flips the parity of whether or not the segment \([Y_1,Y_2]\) is included in the polygon.
|
| 16 |
+
Moreover, since the polygon is simple, we can prove that never is it possible that some points of \([Y_1,Y_2]\) is inside the polynomial while some points are outside.
|
| 17 |
+
|
| 18 |
+
Thus, if an arbitrary point in \([Y_1,Y_2]\) was included in the interior of the polygon, then by the focused edge the entire \([Y_1,Y_2]\) will become outside the polygon.
|
| 19 |
+
Conversely, if a point in \([Y_1,Y_2]\) was not included in the polygon, then the entire \([Y_1,Y_2]\) will become inside the polygon.
|
| 20 |
+
|
| 21 |
+
Therefore, if we can process “add \(1\) to a segment”, “add \(-1\) to a segment”, and “get the value of a point” fast, then we can manage whether the points of each \(y\) coordinate is included in the polygon.
|
| 22 |
+
Such operations can be implemented with a segment tree with lazy propagation (`Lazy Segtree` in ACL).
|
| 23 |
+
|
| 24 |
+
Now let us consider general \(N\).
|
| 25 |
+
First, we perform the operations described above for each polygon in order to classify the edges (parallel to the \(y\) axis) into two kinds.
|
| 26 |
+
In order to answer the question, it is sufficient to manage, for each point of each \(y\) coordinate, how many polygons include the point; this can be accomplished by performing “add \(1\) to a segment”, “add \(-1\) to a segment”, and “get the value of a point” fast, just like before.
|
| 27 |
+
Hence, we could solve the problem by sorting the off-line queries and the edges (parallel to the \(y\) axis) in the increasing order of \(x\) coordinates.
|
problems/PA-03/Atcoder/abc211_f/judge.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"time_limit_s": 2.0,
|
| 3 |
+
"time_limit_source": "task page",
|
| 4 |
+
"memory_mb": 1024,
|
| 5 |
+
"memory_source": "task page",
|
| 6 |
+
"mode": "exact",
|
| 7 |
+
"validator_flags": "case_sensitive",
|
| 8 |
+
"comparison": "token-wise, whitespace-insensitive, case-sensitive (AtCoder's checker)",
|
| 9 |
+
"validator": null,
|
| 10 |
+
"tests_dir": "data",
|
| 11 |
+
"answer_suffix": ".out",
|
| 12 |
+
"n_sample": null,
|
| 13 |
+
"n_secret": 40,
|
| 14 |
+
"note": "no sample/secret split: the statement's samples are among the numbered tests"
|
| 15 |
+
}
|
problems/PA-03/Atcoder/abc211_f/meta.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"task_id": "abc211_f",
|
| 3 |
+
"contest": "abc211",
|
| 4 |
+
"type": "ABC",
|
| 5 |
+
"letter": "F",
|
| 6 |
+
"title": "Rectilinear Polygons",
|
| 7 |
+
"url": "https://atcoder.jp/contests/abc211/tasks/abc211_f",
|
| 8 |
+
"difficulty": 2350,
|
| 9 |
+
"score": 600,
|
| 10 |
+
"time_limit_sec": 2.0,
|
| 11 |
+
"memory_limit_mb": 1024,
|
| 12 |
+
"n_tests": 40,
|
| 13 |
+
"editorial_url": "https://atcoder.jp/contests/abc211/editorial/2333",
|
| 14 |
+
"code_source": "model",
|
| 15 |
+
"pid": "A1644"
|
| 16 |
+
}
|
problems/PA-03/Atcoder/abc211_f/solution.cpp
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// abc211_f: F - Rectilinear Polygons
|
| 2 |
+
// Written by a model (gpt-6-astra) from the official editorial, https://atcoder.jp/contests/abc211/editorial/2333
|
| 3 |
+
// Judged AC on all 40 tests, max 0.12 s of the 2 s limit (submission 1).
|
| 4 |
+
|
| 5 |
+
#include <bits/stdc++.h>
|
| 6 |
+
using namespace std;
|
| 7 |
+
|
| 8 |
+
struct Fenwick {
|
| 9 |
+
int n;
|
| 10 |
+
vector<int> bit;
|
| 11 |
+
explicit Fenwick(int n) : n(n), bit(n + 1, 0) {}
|
| 12 |
+
void add(int p, int value) {
|
| 13 |
+
for (++p; p <= n; p += p & -p) bit[p] += value;
|
| 14 |
+
}
|
| 15 |
+
int get(int p) const {
|
| 16 |
+
int result = 0;
|
| 17 |
+
for (++p; p > 0; p -= p & -p) result += bit[p];
|
| 18 |
+
return result;
|
| 19 |
+
}
|
| 20 |
+
void range_add(int l, int r, int value) {
|
| 21 |
+
add(l, value);
|
| 22 |
+
add(r, -value);
|
| 23 |
+
}
|
| 24 |
+
};
|
| 25 |
+
|
| 26 |
+
struct Edge {
|
| 27 |
+
int x, low, high, delta;
|
| 28 |
+
};
|
| 29 |
+
struct Query {
|
| 30 |
+
int x, y, id;
|
| 31 |
+
};
|
| 32 |
+
|
| 33 |
+
int main() {
|
| 34 |
+
ios::sync_with_stdio(false);
|
| 35 |
+
cin.tie(nullptr);
|
| 36 |
+
|
| 37 |
+
int N;
|
| 38 |
+
cin >> N;
|
| 39 |
+
constexpr int SIZE = 100001;
|
| 40 |
+
Fenwick inside(SIZE);
|
| 41 |
+
vector<Edge> events;
|
| 42 |
+
events.reserve(200000);
|
| 43 |
+
|
| 44 |
+
auto edge_order = [](const Edge& a, const Edge& b) {
|
| 45 |
+
if (a.x != b.x) return a.x < b.x;
|
| 46 |
+
return a.low < b.low;
|
| 47 |
+
};
|
| 48 |
+
|
| 49 |
+
for (int p = 0; p < N; ++p) {
|
| 50 |
+
int M;
|
| 51 |
+
cin >> M;
|
| 52 |
+
vector<Edge> edges;
|
| 53 |
+
edges.reserve(M / 2);
|
| 54 |
+
for (int j = 0; j < M; j += 2) {
|
| 55 |
+
int x1, y1, x2, y2;
|
| 56 |
+
cin >> x1 >> y1 >> x2 >> y2;
|
| 57 |
+
edges.push_back({x1, min(y1, y2), max(y1, y2), 0});
|
| 58 |
+
}
|
| 59 |
+
sort(edges.begin(), edges.end(), edge_order);
|
| 60 |
+
for (Edge e : edges) {
|
| 61 |
+
// Index y represents the height y + 0.5.
|
| 62 |
+
e.delta = (inside.get(e.low) == 0 ? 1 : -1);
|
| 63 |
+
inside.range_add(e.low, e.high, e.delta);
|
| 64 |
+
events.push_back(e);
|
| 65 |
+
}
|
| 66 |
+
// After the last edge, all heights are outside this polygon,
|
| 67 |
+
// so 'inside' is zero and can be reused for the next polygon.
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
int Q;
|
| 71 |
+
cin >> Q;
|
| 72 |
+
vector<Query> queries(Q);
|
| 73 |
+
for (int i = 0; i < Q; ++i) {
|
| 74 |
+
cin >> queries[i].x >> queries[i].y;
|
| 75 |
+
queries[i].id = i;
|
| 76 |
+
}
|
| 77 |
+
sort(events.begin(), events.end(), edge_order);
|
| 78 |
+
sort(queries.begin(), queries.end(), [](const Query& a, const Query& b) {
|
| 79 |
+
return a.x < b.x;
|
| 80 |
+
});
|
| 81 |
+
|
| 82 |
+
Fenwick count(SIZE);
|
| 83 |
+
vector<int> answer(Q);
|
| 84 |
+
size_t pos = 0;
|
| 85 |
+
for (const Query& q : queries) {
|
| 86 |
+
while (pos < events.size() && events[pos].x <= q.x) {
|
| 87 |
+
const Edge& e = events[pos++];
|
| 88 |
+
count.range_add(e.low, e.high, e.delta);
|
| 89 |
+
}
|
| 90 |
+
answer[q.id] = count.get(q.y);
|
| 91 |
+
}
|
| 92 |
+
for (int value : answer) cout << value << '\n';
|
| 93 |
+
return 0;
|
| 94 |
+
}
|
problems/PA-03/Atcoder/abc211_f/statement.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# F - Rectilinear Polygons
|
| 2 |
+
|
| 3 |
+
**Score:** 600 points
|
| 4 |
+
|
| 5 |
+
## Problem Statement
|
| 6 |
+
|
| 7 |
+
We have \(N\) polygons on the \(xy\)-plane.
|
| 8 |
+
Every side of these polygons is parallel to the \(x\)- or \(y\)-axis, and every interior angle is \(90\) or \(270\) degrees. All of these polygons are simple.
|
| 9 |
+
The \(i\)-th polygon has \(M_i\) corners, the \(j\)-th of which is \((x_{i, j}, y_{i, j})\).
|
| 10 |
+
The sides of this polygon are segments connecting the \(j\)-th and \((j+1)\)-th corners. (Assume that \((M_i+1)\)-th corner is the \(1\)-st corner.)
|
| 11 |
+
|
| 12 |
+
<details>
|
| 13 |
+
<summary>A polygon is simple when...</summary>
|
| 14 |
+
for any two of its sides that are not adjacent, they do not intersect (cross or touch) each other.
|
| 15 |
+
</details>
|
| 16 |
+
|
| 17 |
+
You are given \(Q\) queries.
|
| 18 |
+
For each \(i = 1, 2, \dots, Q\), the \(i\)-th query is as follows.
|
| 19 |
+
|
| 20 |
+
- Among the \(N\) polygons, how many have the point \((X_i + 0.5, Y_i + 0.5)\) inside them?
|
| 21 |
+
|
| 22 |
+
## Constraints
|
| 23 |
+
|
| 24 |
+
- \(1 \leq N \leq 10^5\)
|
| 25 |
+
- \(4 \leq M_i \leq 10^5\)
|
| 26 |
+
- Each \(M_i\) is even.
|
| 27 |
+
- \(\sum_i M_i \leq 4 \times 10^5\)
|
| 28 |
+
- \(0 \leq x_{i, j}, y_{i, j} \leq 10^5\)
|
| 29 |
+
- \((x_{i, j}, y_{i, j}) \neq (x_{i, k}, y_{i, k})\) if \(j \neq k\).
|
| 30 |
+
- \(x_{i, j} = x_{i, j+1}\) for \(j = 1, 3, \dots M_i-1\).
|
| 31 |
+
- \(y_{i, j} = y_{i, j+1}\) for \(j = 2, 4, \dots M_i\). (Assume \(y_{i, M_i +1} = y_{i, 1}\).)
|
| 32 |
+
- The given polygons are simple.
|
| 33 |
+
- \(1 \leq Q \leq 10^5\)
|
| 34 |
+
- \(0 \leq X_i, Y_i < 10^5\)
|
| 35 |
+
- All values in input are integers.
|
| 36 |
+
|
| 37 |
+
## Input
|
| 38 |
+
|
| 39 |
+
Input is given from Standard Input in the following format:
|
| 40 |
+
|
| 41 |
+
```
|
| 42 |
+
N
|
| 43 |
+
M_1
|
| 44 |
+
x_{1, 1} y_{1, 1} x_{1, 2} y_{1, 2} ... x_{1, M_1} y_{1, M_1}
|
| 45 |
+
M_2
|
| 46 |
+
x_{2, 1} y_{2, 1} x_{2, 2} y_{2, 2} ... x_{2, M_2} y_{2, M_2}
|
| 47 |
+
...
|
| 48 |
+
M_N
|
| 49 |
+
x_{N, 1} y_{N, 1} x_{N, 2} y_{N, 2} ... x_{N, M_N} y_{N, M_N}
|
| 50 |
+
Q
|
| 51 |
+
X_1 Y_1
|
| 52 |
+
X_2 Y_2
|
| 53 |
+
...
|
| 54 |
+
X_Q Y_Q
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
## Output
|
| 58 |
+
|
| 59 |
+
Print \(Q\) lines.
|
| 60 |
+
The \(i\)-th line should contain the answer to the \(i\)-th query.
|
| 61 |
+
|
| 62 |
+
## Sample Input 1
|
| 63 |
+
```
|
| 64 |
+
3
|
| 65 |
+
4
|
| 66 |
+
1 2 1 4 3 4 3 2
|
| 67 |
+
4
|
| 68 |
+
2 5 2 3 5 3 5 5
|
| 69 |
+
4
|
| 70 |
+
5 6 5 5 3 5 3 6
|
| 71 |
+
3
|
| 72 |
+
1 4
|
| 73 |
+
2 3
|
| 74 |
+
4 5
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
## Sample Output 1
|
| 78 |
+
```
|
| 79 |
+
0
|
| 80 |
+
2
|
| 81 |
+
1
|
| 82 |
+
```
|
| 83 |
+
Note that different polygons may cross or touch each other.
|
| 84 |
+
|
| 85 |
+
## Sample Input 2
|
| 86 |
+
```
|
| 87 |
+
2
|
| 88 |
+
4
|
| 89 |
+
12 3 12 5 0 5 0 3
|
| 90 |
+
12
|
| 91 |
+
1 1 1 9 10 9 10 0 4 0 4 6 6 6 6 2 8 2 8 7 2 7 2 1
|
| 92 |
+
4
|
| 93 |
+
2 6
|
| 94 |
+
4 4
|
| 95 |
+
6 3
|
| 96 |
+
1 8
|
| 97 |
+
```
|
| 98 |
+
|
| 99 |
+
## Sample Output 2
|
| 100 |
+
```
|
| 101 |
+
0
|
| 102 |
+
2
|
| 103 |
+
1
|
| 104 |
+
1
|
| 105 |
+
```
|
| 106 |
+
Although the polygons are simple, they may not be convex.
|
problems/PA-03/Atcoder/abc231_f/data/1.in
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
1
|
| 2 |
+
1
|
| 3 |
+
1
|
problems/PA-03/Atcoder/abc231_f/data/1.out
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
1
|
problems/PA-03/Atcoder/abc231_f/data/10.in
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
problems/PA-03/Atcoder/abc231_f/data/10.out
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
858856462
|
problems/PA-03/Atcoder/abc231_f/data/11.in
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
problems/PA-03/Atcoder/abc231_f/data/11.out
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
4845216277
|
problems/PA-03/Atcoder/abc231_f/data/12.in
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
problems/PA-03/Atcoder/abc231_f/data/12.out
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
2810211395
|
problems/PA-03/Atcoder/abc231_f/data/13.in
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
problems/PA-03/Atcoder/abc231_f/data/13.out
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
11096810814
|
problems/PA-03/Atcoder/abc231_f/data/14.in
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
problems/PA-03/Atcoder/abc231_f/data/14.out
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
976929841
|
problems/PA-03/Atcoder/abc231_f/data/15.in
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
problems/PA-03/Atcoder/abc231_f/data/15.out
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
4103980557
|
problems/PA-03/Atcoder/abc231_f/data/16.in
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
problems/PA-03/Atcoder/abc231_f/data/16.out
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
4479565468
|
problems/PA-03/Atcoder/abc231_f/data/17.in
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
problems/PA-03/Atcoder/abc231_f/data/17.out
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
10006512085
|
problems/PA-03/Atcoder/abc231_f/data/18.in
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
problems/PA-03/Atcoder/abc231_f/data/18.out
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
5436914470
|
problems/PA-03/Atcoder/abc231_f/data/19.in
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|