跳到正文

2024Lsx

1375036

你是不是对***干了手脚

在洛谷打开
资料、奖项与版本

资料

编号
1375036
抓取

goj

啊!!

账号

[脆皮](https://g8hh.github.io/cuipi/)\color{white}[脆皮](https://g8hh.github.io/cuipi/)

orzGEOTCBRL114514 STO_ORZ

C++
#include <bits/stdc++.h>
using namespace std;
#define int long long
int n, ans, k;
priority_queue<int> q;
signed main() {
	cin>>n;
	for (int i = 1; i <= n; ++i) {
		cin>>k;
		if (!q.empty() && -q.top() < k) ans += k + q.top(), q.pop(), q.push(-k);
		q.push(-k);
	}
	cout<<ans;
	return 0;
}

JSESSIONID=30BEBE2020CE77D99ED2BBAF2107D232

共 1 篇
  1. 个人记录

    Game

    小游戏合集 你能AKIOI吗(点击) 正常的2048 名称竞技场 生命小游戏 稍微卡一点但是很好玩 Game集合1 小黑屋 让人玩到自闭的尺规作图游戏(Eulidea) Game集合2 网络答题(?) 猫国建设者(与小黑屋类似) 飞翔的小鸟 国际象棋 太空公司(与小黑屋类似) 球…