暗示法萨芬电饭锅电饭锅第三个奢风格

//#pragma GCC optimize(3)
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Aatrowen
 */

 /*
 ░░░░░░░░░▄░░░░░░░░░░░░░░▄░░░░
 ░░░░░░░░▌▒█░░░░░░░░░░░▄▀▒▌░░░
 ░░░░░░░░▌▒▒█░░░░░░░░▄▀▒▒▒▐░░░
 ░░░░░░░▐▄▀▒▒▀▀▀▀▄▄▄▀▒▒▒▒▒▐░░░
 ░░░░░▄▄▀▒░▒▒▒▒▒▒▒▒▒█▒▒▄█▒▐░░░
 ░░░▄▀▒▒▒░░░▒▒▒░░░▒▒▒▀██▀▒▌░░░
 ░░▐▒▒▒▄▄▒▒▒▒░░░▒▒▒▒▒▒▒▀▄▒▒▌░░
 ░░▌░░▌█▀▒▒▒▒▒▄▀█▄▒▒▒▒▒▒▒█▒▐░░
 ░▐░░░▒▒▒▒▒▒▒▒▌██▀▒▒░░░▒▒▒▀▄▌░
 ░▌░▒▄██▄▒▒▒▒▒▒▒▒▒░░░░░░▒▒▒▒▌░
 ▀▒▀▐▄█▄█▌▄░▀▒▒░░░░░░░░░░▒▒▒▐░
 ▐▒▒▐▀▐▀▒░▄▄▒▄▒▒▒▒▒▒░▒░▒░▒▒▒▒▌
 ▐▒▒▒▀▀▄▄▒▒▒▄▒▒▒▒▒▒▒▒░▒░▒░▒▒▐░
 ░▌▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒░▒░▒░▒░▒▒▒▌░
 ░▐▒▒▒▒▒▒▒▒▒▒▒▒▒▒░▒░▒░▒▒▄▒▒▐░░
 ░░▀▄▒▒▒▒▒▒▒▒▒▒▒░▒░▒░▒▄▒▒▒▒▌░░
 ░░░░▀▄▒▒▒▒▒▒▒▒▒▒▄▄▄▀▒▒▒▒▄▀░░░
 ░░░░░░▀▄▄▄▄}▀▀▒▒▒▒▒▄▄▀░░░░░
 ░░░░░░░░░▒▒▒▒▒▒▒▒▒▒▀▀░░░░░░░░
 */

#include<iostream>
#include<algorithm>
#include<string.h>
#include <set>
#include<math.h>
#include<cstdio>
#include <vector>
#include<map>
#include<string>
#include<cstring>
#include<numeric>
#include<cmath>
#include<queue>
#include <functional>
#include<stack>
#include<bits/stdc++.h>
using  namespace std;

namespace UncoverU {
#define Fast std::ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define SQR(i) fixed<<setprecision(i)
#define endl '\n'
	typedef pair<int, int> pll;
	typedef long long ll;
	typedef unsigned long long ull;
	typedef unsigned u;
	typedef double db;
#define inf 0x3f3f3f3f
#define inf_max 0x7f7f7f7f
#define fi first
#define se second
	const int infi = 1e9;
	const ll infl = 4e18;
	const db pi = acos(-1.0);
	inline ll ceil_div(ll a, ll b) {
		return (a + b - 1) / b;
	}
	inline ll pos_mod(ll a, ll b) {
		return (a % b + b) % b;
	}
#define FR(a) freopen(a,"r",stdin);
#define FW(a) freopen(a,"w",stdout);
#define RW(a, b) {freopen(a,"r",stdin),freopen(b,"w",stdout);}
#define SR srand((unsigned )time(NULL));
#define MT mt19937 rnd(time(0));
#define MT64 mt19937_64 rnd(time(0));
}
using namespace UncoverU;
//void put(int x) {
//	int num = 0;
//	char c[15];
//	while (x) c[++num] = (x % 10) + 48, x /= 10;
//	while (num) putchar(c[num--]);
//	putchar('\n');
//}
//inline void write(int x) {
//	if (x < 0) putchar('-'), x = -x;
//	if (x > 9) write(x / 10);
//	putchar(x % 10 + '0');
//}
#define int long long
#define Fast std::ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define SQR(i) fixed<<setprecision(i)
#define int long long
typedef long long ll;
#define endl '\n'
#define int long long
#define inf 0x3f3f3f3f
#define inf_max 0x7f7f7f7f
#define minn 0xc0c0c0c0c0c0c0c0
#define Srand srand((unsigned )time(NULL));
inline ll read() { ll f = 1; ll x = 0; char ch = getchar(); while (ch > '9' || ch < '0') { if (ch == '-') f = -1; ch = getchar(); }while (ch >= '0' && ch <= '9') x = (x << 3) + (x << 1) + ch - '0', ch = getchar(); return x * f; }
inline ll qpow(ll a, ll b, ll MOD) { ll res = 1; a %= MOD; while (b > 0) { if (b & 1)res = res * a % MOD; a = a * a % MOD; b >>= 1; }return res; }
typedef pair<int, int> PII;
const double pi = acos(-1.0);
const int MAX_N = 1e9 + 3;
const int N = 2e6 + 5;
const int mod = 1e9 + 7;


int a[N];
void Solve() {
	queue<int>q1, q2, q3;
	int n; cin >> n;
	for (int i = 1; i <= n; ++i)
	{
		int x; cin >> x;
		q1.push(x);
	}
	int k; cin >> k;
	while (k--)
	{
		string s; int x;
		cin >> s >> x;
		if (s == "FIRST"&&!a[x])
		{
			q2.push(x);
			a[x]++;
		}
		else if(s=="LAST" && !a[x])
		{
			q3.push(x);
			a[x]++;
		}
	}
	while (q2.size())
	{
		cout << q2.front() << " ";
		q2.pop();
	}
	while (q1.size())
	{
		int x = q1.front();
		if (a[x] == 0)cout << x << " ";
		q1.pop();
	}
	while (q3.size())
	{
		cout << q3.size() << " ";
		q3.pop();
	}

}

signed main()
{
	std::ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	
	Solve();
}


/*
 [[ ⣇⣿⠘⣿⣿⣿⡿⡿⣟⣟⢟⢟⢝⠵⡝⣿⡿⢂⣼⣿⣷⣌⠩⡫⡻⣝⠹⢿⣿⣷ ]],
 [[ ⡆⣿⣆⠱⣝⡵⣝⢅⠙⣿⢕⢕⢕⢕⢝⣥⢒⠅⣿⣿⣿⡿⣳⣌⠪⡪⣡⢑⢝⣇ ]],
 [[ ⡆⣿⣿⣦⠹⣳⣳⣕⢅⠈⢗⢕⢕⢕⢕⢕⢈⢆⠟⠋⠉⠁⠉⠉⠁⠈⠼⢐⢕⢽ ]],
 [[ ⡗⢰⣶⣶⣦⣝⢝⢕⢕⠅⡆⢕⢕⢕⢕⢕⣴⠏⣠⡶⠛⡉⡉⡛⢶⣦⡀⠐⣕⢕ ]],
 [[ ⡝⡄⢻⢟⣿⣿⣷⣕⣕⣅⣿⣔⣕⣵⣵⣿⣿⢠⣿⢠⣮⡈⣌⠨⠅⠹⣷⡀⢱⢕ ]],
 [[ ⡝⡵⠟⠈⢀⣀⣀⡀⠉⢿⣿⣿⣿⣿⣿⣿⣿⣼⣿⢈⡋⠴⢿⡟⣡⡇⣿⡇⡀⢕ ]],
 [[ ⡝⠁⣠⣾⠟⡉⡉⡉⠻⣦⣻⣿⣿⣿⣿⣿⣿⣿⣿⣧⠸⣿⣦⣥⣿⡇⡿⣰⢗⢄ ]],
 [[ ⠁⢰⣿⡏⣴⣌⠈⣌⠡⠈⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣬⣉⣉⣁⣄⢖⢕⢕⢕ ]],
 [[ ⡀⢻⣿⡇⢙⠁⠴⢿⡟⣡⡆⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣵⣵⣿ ]],
 [[ ⡻⣄⣻⣿⣌⠘⢿⣷⣥⣿⠇⣿⣿⣿⣿⣿⣿⠛⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿ ]],
 [[ ⣷⢄⠻⣿⣟⠿⠦⠍⠉⣡⣾⣿⣿⣿⣿⣿⣿⢸⣿⣦⠙⣿⣿⣿⣿⣿⣿⣿⣿⠟ ]],
 [[ ⡕⡑⣑⣈⣻⢗⢟⢞⢝⣻⣿⣿⣿⣿⣿⣿⣿⠸⣿⠿⠃⣿⣿⣿⣿⣿⣿⡿⠁⣠ ]],
 [[ ⡝⡵⡈⢟⢕⢕⢕⢕⣵⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣶⣿⣿⣿⣿⣿⠿⠋⣀⣈⠙ ]],
 [[ ⡝⡵⡕⡀⠑⠳⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⢉⡠⡲⡫⡪⡪⡣ ]],
  */

typedef vector<double> Point;

double ThreeDot(Point p, Point a, Point b) {
	return(a[0] - p[0]) * (b[0] - p[0]) + (a[1] - p[1]) * (b[1] - p[1]) + (a[2] - p[2]) * (b[2] - p[2]);
}//pa与pb的点积 (3点)   

Point ThreeCross(Point p, Point a, Point b) {
	double x, y, z;
	x = (a[1] - p[1]) * (b[2] - p[2]) - (a[2] - p[2]) * (b[1] - p[1]);
	y = (a[2] - p[2]) * (b[0] - p[0]) - (a[0] - p[0]) * (b[2] - p[2]);
	z = (a[0] - p[0]) * (b[1] - p[1]) - (a[1] - p[1]) * (b[0] - p[0]);
	Point C;
	C.push_back(x), C.push_back(y); C.push_back(z);
	return C;
}//pa与pb的叉积(3点)

double ThreeDot(Point a, Point b) {
	return a[0] * b[0] + a[1] * b [1] + a[2] * b[2];
}//向量a与b的点积 (向量)

Point ThreeCross(Point a, Point b) {

	int C[3];
	C[0] = a[1] * b[2] - a[2] * b[1];
	C[1] = a[2] * b[0] - a[0] * b[2];
	C[2] = a[0] * b[1] - a[1] * b[0];
	Point nC;
	nC.push_back(C[0]), nC.push_back(C[1]), nC.push_back(C[2]);
	return nC;
}//向量a与b的叉积(向量

老师发哈拉好大风

上面为测试

int n, m;
int a[N];
void Solve() {
	cin >> n;
	priority_queue<int,vector<int>, greater<int>>q;
	for (int i = 1; i <= n; ++i)
	{
		int x; cin >> x;
		q.push(x);
	}
	int ans = 0;
	while (q.size() > 1)
	{
		int k1 = q.top();
		q.pop();
		int k2 = q.top();
		q.pop();
		int res = k1 + k2;
		q.push(res);
		ans += res;
	}
	cout << ans << endl;
}

代码 不要看!!!!!!!!!!!!!!!!!!!!!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值