比赛 20251026新安模拟赛2 评测结果 AAAAAAAAAAAAAAAAAAAA
题目名称 决斗 最终得分 100
用户昵称 tomato的 运行时间 0.526 s
代码语言 C++ 内存使用 3.93 MiB
提交时间 2025-10-26 09:29:22
显示代码纯文本
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, js = 0;
priority_queue<int > q, p;
int main(){
	freopen("duel.in", "r", stdin);
	freopen("duel.out", "w", stdout);
	cin >> n;
	for(int i = 1; i <= n; i++){
		int l;
		cin >> l;
		q.push(l);
	}
	while(!q.empty()){
		p.push(q.top());
		q.pop();
		if(q.top() != p.top() && !q.empty() && !p.empty()){
			p.pop();
		}
	}
	while(!p.empty()){
		js++;
		p.pop();
	}
	cout << js;
	return 0;
}