文章
166
粉丝
68
获赞
855
访问
61.7k
#include <bits/stdc++.h>
using namespace std;
struct pl {
int a, b;
pl(int a, int b): a(a), b(b) {}
bool operator < (pl y) const {
return a * a + b * b < y.a * y.a + y.b * y.b;
}
};
int main() {
int n;
while (cin >> n) {
priority_queue<pl> pq;
while (n--) {
string s;
cin >> s;
if (s == "Pop") {
if (pq.empty()) {
cout << "empty" << endl;
} else {
int a=pq.top().a,b=pq.top().b;
cout<<a<<"+i"<<b<<endl;
pq.pop();
cout << "SIZE = " << pq.size() << endl;
}
} else {
int a, b;
char plus, i;
cin >> a >> plus >> i >> b;
if (plus == '+' && i...
登录后发布评论
暂无评论,来抢沙发