难度:4
属于比较复杂的模拟,但是刘汝佳的翻译很详细了,不像他说的还要参考原题,但是书上有一处写错了,书上写的是地图总数超过i,应该是i超过包含它的地图的最大详细等级,这样地图里面没有详细等级i,就需要特殊情况输出了。
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pa;
struct Map {
string name;
double x1, y1, x2, y2, area, ratio;
int level;
Map() {
}
Map(string a, double b, double c, double d, double e, double f, double g): name(a), x1(b), y1(c), x2(d), y2(e), area(f), ratio(g) {
}
};
string s;
map<string, pair<double, double> > mp1;
bool baohan(Map a, pair<double, double> b) {
double x1 = min(a.x1, a.x2);
double x2 = max(a.x1, a.x2);
double y1 = min(a.y1, a.y2);
double y2 = max(a.y1, a.