Skip to content

Commit 2e032ff

Browse files
committed
first commit
ピースやフレームを定義し,入力まで書いた
0 parents  commit 2e032ff

File tree

6 files changed

+109
-0
lines changed

6 files changed

+109
-0
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.waf*
2+
*.swp
3+
/waf

Makefile

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
.PHONEY: all
3+
4+
all: waf
5+
./waf configure build
6+
7+
waf:
8+
curl https://waf.io/waf-1.9.4 -o waf
9+
chmod +x waf

src/Geo.cpp

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#include "Geo.hpp"
2+
3+
namespace procon28 {
4+
/* Polygonの入力 */
5+
std::istream &operator>>(std::istream &is, Polygon &polygon) {
6+
int N;
7+
is >> N;
8+
polygon.outer().clear();
9+
polygon.outer().reserve(N);
10+
for (int i = 0; i < N; ++i) {
11+
long double x, y;
12+
is >> x >> y;
13+
polygon.outer().emplace_back(x, y);
14+
}
15+
16+
bg::correct(polygon);
17+
return is;
18+
}
19+
/* Polygonの出力 */
20+
std::ostream& operator<<(std::ostream& os, Polygon& polygon) {
21+
int N = polygon.outer().size();
22+
os << N << '\n';
23+
for (auto&& point : polygon.outer()) {
24+
os << point.x() << " " << point.y() << '\n';
25+
}
26+
27+
std::flush();
28+
}
29+
30+
} // namespace procon28

src/Geo.hpp

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#ifndef PROCON_28_GEO_HPP
2+
#define PROCON_28_GEO_HPP
3+
4+
#include <iostream>
5+
#include <vector>
6+
7+
#include <boost/geometry/geometries/point_xy.hpp>
8+
#include <boost/geometry/geometries/polygon.hpp>
9+
#include <boost/geometry/geometries/segment.hpp>
10+
#include <boost/geometry/geometry.hpp>
11+
12+
namespace bg = boost::geometry;
13+
14+
namespace procon28 {
15+
using Point = bg::model::d2::point_xy<long double>;
16+
using Polygon = bg::model::polygon<Point>;
17+
using Hole = Polygon;
18+
using Piece = Polygon;
19+
using Segment = bg::model::segment<Point>;
20+
21+
std::istream& operator>>(std::istream& is, Polygon& polygon);
22+
std::ostream& operator<<(std::ostream& os, Polygon& Polygon);
23+
24+
} // namespace procon28
25+
26+
#endif

src/Main.cpp

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#include "Geo.hpp"
2+
#include <vector>
3+
4+
using namespace procon28;
5+
6+
int main() {
7+
using std::cin;
8+
using std::cout;
9+
using std::endl;
10+
11+
std::vector<Hole> holes;
12+
std::vector<Piece> pieces;
13+
int holes_N, pieces_N;
14+
15+
cin >> holes_N;
16+
holes.reserve(holes_N);
17+
for (int i = 0; i < holes_N; ++i) {
18+
Hole hole;
19+
cin >> hole;
20+
holes.emplace_back(hole);
21+
}
22+
23+
cin >> pieces_N;
24+
pieces.reserve(pieces_N);
25+
for (int i = 0; i < pieces_N; ++i) {
26+
Piece piece;
27+
cin >> piece;
28+
pieces.emplace_back(piece);
29+
}
30+
}

wscript

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/local/bin/python
2+
3+
def configure(conf):
4+
conf.load("clang++")
5+
6+
def build(bld):
7+
bld(features="cxx cxxprogram",
8+
source="./src/Main.cpp ./src/Geo.cpp",
9+
target="solver",
10+
includes=[".", ".."],
11+
cxxflags=["-std=c++14", "-O3", "-march=native"])

0 commit comments

Comments
 (0)