回答編集履歴
3
修正
test
CHANGED
@@ -28,7 +28,7 @@
|
|
28
28
|
|
29
29
|
struct P2 {
|
30
30
|
|
31
|
-
P2(int
|
31
|
+
P2(int y, int x) : y(y), x(x)
|
32
32
|
|
33
33
|
{
|
34
34
|
|
2
修正
test
CHANGED
@@ -39,6 +39,8 @@
|
|
39
39
|
bool operator<(const P2 &rhs) const
|
40
40
|
|
41
41
|
{
|
42
|
+
|
43
|
+
// y の値を優先してソートするなら
|
42
44
|
|
43
45
|
return y != rhs.y ? y < rhs.y : x < rhs.x;
|
44
46
|
|
1
修正
test
CHANGED
@@ -76,9 +76,9 @@
|
|
76
76
|
|
77
77
|
|
78
78
|
|
79
|
-
for (const auto &
|
79
|
+
for (const auto &point : s2)
|
80
80
|
|
81
|
-
std::cout << "(y, x) = " <<
|
81
|
+
std::cout << "(y, x) = " << point.y << "," << point.x << std::endl;
|
82
82
|
|
83
83
|
}
|
84
84
|
|