当前位置:网站首页>2022.07.14 summer training personal qualifying (IX)
2022.07.14 summer training personal qualifying (IX)
2022-07-19 11:46:00 【Chao Tang】
2022.07.14 Summer training Individual qualifying ( Nine )
Post game introspection
nothing
Problem F
Source
Codeforces-844D
Answer key
Think the other way , In fact, it's just merging fruits , Turned into 3 Pile up .
Code
// Good Good Study, Day Day AC.
#include <iostream>
#include <stdio.h>
#include <cstdio>
#include <stdlib.h>
#include <string>
#include <string.h>
#include <cstring>
#include <math.h>
#include <cmath>
#include <queue>
#include <deque>
#include <stack>
#include <vector>
#include <map>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#define ffor(i,a,b) for(int i=(a) ;i<=(b) ;i++)
#define rrep(i,a,b) for(int i=(a) ;i>=(b) ;i--)
#define mst(v,s) memset(v,s,sizeof(v))
#define IOS ios::sync_with_stdio(false),cin.tie(0)
#define ll long long
#define INF 0x7f7f7f7f7f7f7f7f
#define inf 0x7f7f7f7f
#define PII pair<int,int>
#define int long long
using namespace std;
int n, T = 1, ans;
priority_queue<int, vector<int>, greater<int> >q;
void ready()
{
cin >> n;
ffor(i, 1, n) {
int a;
cin >> a;
q.push(a);
}
if (n % 2 == 0) q.push(0);
while (q.size() > 1) {
int a = q.top(); q.pop();
int b = q.top(); q.pop();
int c = q.top(); q.pop();
int d = a + b + c;
ans += d;
q.push(d);
}
cout << ans;
}
void work()
{
}
signed main()
{
IOS;
// cin>>T;
while (T--) {
ready();
work();
}
return 0;
}
Problem H
Source
Codeforces-722C
Answer key
Think backwards , If you turn the deletion upside down into an addend . Add one number at a time , Look at the farthest place on its left , Where is the farthest way to the right , Then update the sum of this interval , And remember to fill the left and right sides .
Code
// Good Good Study, Day Day AC.
#include <iostream>
#include <stdio.h>
#include <cstdio>
#include <stdlib.h>
#include <string>
#include <string.h>
#include <cstring>
#include <math.h>
#include <cmath>
#include <queue>
#include <deque>
#include <stack>
#include <vector>
#include <map>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#define ffor(i,a,b) for(int i=(a) ;i<=(b) ;i++)
#define rrep(i,a,b) for(int i=(a) ;i>=(b) ;i--)
#define mst(v,s) memset(v,s,sizeof(v))
#define IOS ios::sync_with_stdio(false),cin.tie(0)
#define ll long long
#define INF 0x7f7f7f7f7f7f7f7f
#define inf 0x7f7f7f7f
#define PII pair<int,int>
#define int long long
using namespace std;
const int N=1e5+5;
int T=1;
int n,m;
int a[N];
int sum[N];
int id[N];
int l[N],r[N];
int ans;
void ready()
{
stack<int>q;
cin>>n;
ffor(i,1,n) cin>>a[i];
ffor(i,1,n) cin>>id[i];
ffor(i,1,n) sum[i]=sum[i-1]+a[i];
ffor(i,1,n){
r[i]=0;
l[i]=n+1;
}
q.push(0);
rrep(i,n,1){
int ad=id[i];
l[ad]=min(ad,l[ad-1]);
r[ad]=max(ad,r[ad+1]);
r[l[ad]]=r[ad];
l[r[ad]]=l[ad];
ans=max(ans,sum[r[ad]]-sum[l[ad]-1]);
q.push(ans);
}
q.pop();
while(q.size()){
cout<<q.top()<<'\n';
q.pop();
}
}
void work()
{
}
signed main()
{
IOS;
ready();
//cin>>T;
while (T--) {
work();
}
return 0;
}
边栏推荐
- 公网连接MySQL实例的解决方案
- Sword finger offer II 041 Average value of sliding window
- An error, uncaught typeerror: modalfactory is not a constructor
- Leetcode 1252. 奇数值单元格的数目
- Resources for physics based simulation in computer graphics
- Solution of connecting MySQL instance with public network
- Leetcode 1328. 破坏回文串(可以,已解决)
- Property analysis of rotate matrix (forwarding)
- Hello JSON Schema
- Antd form setting array fields
猜你喜欢

Leetcode 1304. 和为零的 N 个不同整数

Docker安装MySQL

MySQL autoincrement ID, UUID and snowflake ID

Detailed explanation of MySQL show processlist

性能优化之@Contended减少伪共享

Leetcode 1252. 奇数值单元格的数目

Delegate parents and other loaders
![[wechat applet] use a thousand hand float - rollback](/img/52/4939ff2a644c46fdb388a64ac111c6.png)
[wechat applet] use a thousand hand float - rollback

Keras deep learning practice (14) -- r-cnn target detection from scratch

Opencv draw a black rectangle and write the serial number
随机推荐
Unity3d read mpu9250 example source code
[untitled] CV learning 1 conversion
Hello JSON Schema
Robot development -- robot data summary
Introduction to common distributed locks
Leetcode skimming -- find and minimum k-pair number 373 medium
Redis分布式緩存-Redis集群
【无标题】cv 学习1转换
华为无线设备配置频谱导航
From "passive" to "active", how can zeta technology help to upgrade "rfid2.0"?
function/symbol ‘pango_context_set_round_glyph_positions‘ not found in library ‘libpango-1.0.so.0‘x
Region performance tuning
Delegate parents and other loaders
Will causal learning open the next generation of AI? Chapter 9 Yunji datacanvas officially released the open source project of ylarn causal learning
TiKV 内存参数性能调优
A current List of AWESOME Qt and qml
Chapter 1 of creating virtual machine (vmvare virtual machine)
热议:老公今年已经34周岁想读博,以后做科研,怎么办?
How to build dashboard and knowledge base in double chain note taking software? Take the embedded widget library notionpet as an example
Developing those things: how to solve the problem of long-time encoding and decoding of RK chip video processing?