Skip to content

Commit f4e7aa8

Browse files
committed
1 parent a266cfc commit f4e7aa8

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

myCpps/maps.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
using namespace std;
44

5-
ifstream fin("maps.in");
5+
ifstream fin("lineSweep.in");
66
ofstream fout("maps.out");
77

88
const int inf = INT_MAX / 2;
@@ -51,7 +51,12 @@ int main()
5151
set<double> _set;
5252
for (int i = 0; i <= n - 1; ++i)
5353
{
54-
fin >> a_t[i].x1 >> a_t[i].y1 >> a_t[i].x2 >> a_t[i].y2;
54+
double t1, t2, t3, t4; fin >> t1 >> t2 >> t3 >> t4;
55+
a_t[i].x1 = min(t1, t3);
56+
a_t[i].y1 = min(t2, t4);
57+
a_t[i].x2 = max(t1, t3);
58+
a_t[i].y2 = max(t2, t4);
59+
5560
_set.insert(a_t[i].x1);
5661
_set.insert(a_t[i].y1);
5762
_set.insert(a_t[i].x2);
@@ -88,7 +93,7 @@ int main()
8893
sort(l.begin(), l.end());
8994

9095
int sizeL = l.size();
91-
vector<double> h(itod.size() + 1, 0.0);
96+
vector<double> h(sizeL, 0.0);
9297
for (int i = 0; i <= sizeL - 2; ++i)
9398
{
9499
int nowX = l[i].x, nextX = l[i + 1].x;
@@ -127,7 +132,7 @@ int main()
127132
//ans = (int)(ans * 100.0 + 0.5) / 100.0;
128133

129134
fout << "Test case #" << t << '\n';
130-
fout << "Total explored area: " << ans << '\n';
135+
fout << "Total explored area: " << ans << "\n\n";
131136

132137
}
133138
return 0;

myCpps/mapsOJ.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,12 @@ int main()
5151
set<double> _set;
5252
for (int i = 0; i <= n - 1; ++i)
5353
{
54-
cin >> a_t[i].x1 >> a_t[i].y1 >> a_t[i].x2 >> a_t[i].y2;
54+
double t1, t2, t3, t4; cin >> t1 >> t2 >> t3 >> t4;
55+
a_t[i].x1 = min(t1, t3);
56+
a_t[i].y1 = min(t2, t4);
57+
a_t[i].x2 = max(t1, t3);
58+
a_t[i].y2 = max(t2, t4);
59+
5560
_set.insert(a_t[i].x1);
5661
_set.insert(a_t[i].y1);
5762
_set.insert(a_t[i].x2);
@@ -88,7 +93,7 @@ int main()
8893
sort(l.begin(), l.end());
8994

9095
int sizeL = l.size();
91-
vector<double> h(itod.size() + 1, 0.0);
96+
vector<double> h(sizeL, 0.0);
9297
for (int i = 0; i <= sizeL - 2; ++i)
9398
{
9499
int nowX = l[i].x, nextX = l[i + 1].x;
@@ -126,7 +131,7 @@ int main()
126131

127132

128133
cout << "Test case #" << t << '\n';
129-
cout << "Total explored area: " << ans << '\n';
134+
cout << "Total explored area: " << ans << "\n\n";
130135

131136
}
132137
cout.flush();

0 commit comments

Comments
 (0)