rt。
写了个优先队列的贪心暴力,将相邻的两队排序。
#include <bits/stdc++.h>
using namespace std;
inline int read(){int x=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}return x*f;}
inline void write(int x){if (x < 0) x = ~x + 1, putchar('-');if (x > 9) write(x / 10);putchar(x % 10 + '0');}
inline void writeln(int x){write(x);putchar('\n');}
inline void writesp(int x){write(x);putchar(' ');}
priority_queue<pair<int,int> >q;
int main()
{
int n=read();
for(int i=1;i<=n/2;i++)
{
int a=read(),b=read();
q.push(make_pair(a,b));
}
while(q.size())
{
cout<<q.top().first<<' '<<q.top().second<<' ';
q.pop();
}
return 0;
}
但是喜提0pts。
这种做法能修改吗?还是说完全假掉了?