This commit is contained in:
Zengtudor 2024-10-20 11:29:20 +08:00
parent 58a0456b20
commit 1de78a12e0
29 changed files with 1638 additions and 0 deletions

Binary file not shown.

View File

@ -0,0 +1,4 @@
0
1
2
2

View File

@ -0,0 +1,5 @@
4
)(
(())
()()()()
(()(())())

View File

@ -0,0 +1,10 @@
4
5
4
5
3
5
4
3
4
5

View File

@ -0,0 +1,11 @@
10
((((((()())(())()))
(((((((()())))()))))
((()(((())()(())))
(()()()()()((()())))
((((()))()))))))))
((()((()()))()()()))
((()(()(())(((()))()
()()((((((()()())
((((()()))()))))))
(((((((())())))())))

View File

@ -0,0 +1,10 @@
21
22
21
20
22
19
23
24
19
22

View File

@ -0,0 +1,11 @@
10
()()()()(())()((()())(()())((((())()()(((()(()))(((()())((((((())())((()((()(()())(()))(()()()())())
())())((()())))))))((())()(((((()))()(((()(()()()))()))))())(())((()))))(((())(((()))()(())((()()))(
(()))()((())((()()(()))))(()((()())))()())((())))(()(()()())()())(((((((())((()))()((())((()((()()((
)())))()))()()())()(()))())()()()())))))()((()((())(()()((())()(((()))((()))()))())))))(((())()()(((
()()(((()()()((()(()()((((()()(())))))())())))())(((()())((())))))(()))))(()))(())))()()))())))()(()
))()))()(()()()))()()()()))()())())())))())()())(((())))())))))(()()((())(()))())()()(((()))(()()(()
)(((()()))()((((((()))())(()))()(()())(((()(((((((())))(()(()()))))(())(()()(()((()()((()))(())())))
))((()(((((()()((())))()()(())()()))())))((()))((()()()(((()(((()(()()()))))(())())()((())(()())))()
()))()))()))())))()))))())(()())((())())(())(())((()(())))(())()((()))(()()))(())()((()))))()))))(((
()(((())(()(()))(())(())()))))))(()))(((())()(())))((()(()))())(()((((()())))))(())()(((()(()(())(()

View File

@ -0,0 +1,53 @@
#include <algorithm>
#include <array>
#include <cstdio>
#include <iostream>
#include <limits>
#include <queue>
#include <string>
typedef long long ll;
ll n;
const ll max_n = 3e5+5,ll_min{std::numeric_limits<ll>::min()};
std::array<ll, max_n> ans;
std::string s;
void dfs(const ll index,const ll now,const ll m){
if(index==s.size()-1){
ans[m]=std::max(ans[m],now);
return;
}
const ll next_index{index+1};
if(s[next_index]=='+'){
dfs(next_index,now+1,m);
}else{
dfs(next_index,now-1,m);
}
dfs(next_index,(now^1),m+1);
}
int main(){
freopen("confess.in", "r", stdin);
freopen("confess.out", "w", stdout);
std::cin>>n;
for(ll _{0};_<n;_++){
std::cin>>s;
s=' '+s;
ans.fill(ll_min);
if(s[1]=='+'){
dfs(1,1,0);
}else{
dfs(1,-1,0);
}
dfs(1,0+(0^1),1);
for(ll i{0};i<s.size();i++){
// std::cout<<"i:"<<i<<' ';
std::cout<<ans[i]<<' ';
}
std::cout<<'\n'<<std::flush;
}
}

View File

@ -0,0 +1,5 @@
4
+
--
+--
++-+--++

View File

@ -0,0 +1,4 @@
1 1
-2 0 0
-1 1 1 1
2 4 6 6 6 6 4 2 0

View File

@ -0,0 +1,4 @@
1 1
-2 0 0
-1 1 1 1
2 4 6 6 6 6 4 2 0

View File

@ -0,0 +1,21 @@
11 13 15 15 15 15 15 15 15 15 15 13 11 9 7 5 3 1
12 14 16 16 16 16 16 16 16 14 12 10 8 6 4 2 0
5 7 9 11 13 15 15 15 15 15 15 13 11 9 7 5 3 1
6 8 10 12 14 14 14 14 14 14 12 10 8 6 4 2 0
-1 1 3 5 7 9 9 9 9 9 9 9 9 9 7 5 3 1
-6 -4 -2 0 2 4 6 6 6 6 6 6 6 6 6 6 4 2 0
-3 -1 1 3 5 7 7 7 7 7 7 7 7 7 7 5 3 1
-10 -8 -6 -4 -2 0 2 4 4 4 4 4 4 4 4 2 0
-15 -13 -11 -9 -7 -5 -3 -1 1 3 3 3 3 3 3 3 3 1
-17 -15 -13 -11 -9 -7 -5 -3 -1 1 1 1 1 1 1 1 1 1
11 13 15 15 15 15 15 15 15 15 15 13 11 9 7 5 3 1
12 14 16 16 16 16 16 16 16 14 12 10 8 6 4 2 0
5 7 9 11 13 15 15 15 15 15 15 13 11 9 7 5 3 1
6 8 10 12 14 14 14 14 14 14 12 10 8 6 4 2 0
-1 1 3 5 7 9 9 9 9 9 9 9 9 9 7 5 3 1
-6 -4 -2 0 2 4 6 6 6 6 6 6 6 6 6 6 4 2 0
-3 -1 1 3 5 7 7 7 7 7 7 7 7 7 7 5 3 1
-10 -8 -6 -4 -2 0 2 4 4 4 4 4 4 4 4 2 0
-15 -13 -11 -9 -7 -5 -3 -1 1 3 3 3 3 3 3 3 3 1
-17 -15 -13 -11 -9 -7 -5 -3 -1 1 1 1 1 1 1 1 1 1

View File

@ -0,0 +1,11 @@
10
+++++++++++-++-+-
++++-+++-+++++++
---+++-+++-+++++-
+++--+-+-+++-+++
--+++++------+-++
+------++--+---++-
-++-+----+--+--++
-------+---++---
-----------+-----
-----------------

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,51 @@
#include <cstdio>
#include <iostream>
#include <string>
using ll = long long;
ll n;
std::string s;
int main(){
#ifdef ONLINE_JUDGE
freopen("confess.in", "r", stdin);
freopen("confess.out", "w", stdout);
#endif
std::cin>>n;
for(ll _{0};_<n;_++){
std::cin>>s;
ll odd_add_num{}; //奇数+ -> -2
ll even_sub_num{};//偶数- -> +2
ll sum{};
for(ll i{0};i<s.size();i++){
if(s[i]=='+'){
if(i&1){
++odd_add_num;
}
sum++;
}else{
if((i&1)==0){
even_sub_num++;
}
sum--;
}
}
std::cout<<sum<<' ';
for(ll j{0};j<even_sub_num;j++){
sum+=2;
std::cout<<sum<<' ';
}
for(ll j{0};j<(s.size()-odd_add_num-even_sub_num);j++){
std::cout<<sum<<' ';
}
for(ll j{0};j<odd_add_num;j++){
sum-=2;
std::cout<<sum<<' ';
}
std::cout<<'\n';
}
}

View File

@ -0,0 +1 @@
28

View File

@ -0,0 +1,2 @@
3 2
1 2 3

View File

@ -0,0 +1 @@
105878520

View File

@ -0,0 +1,2 @@
10 4
1 2 3 4 5 6 7 8 9 10

View File

@ -0,0 +1 @@
854514148

View File

@ -0,0 +1,2 @@
18 2
150828217 183012810 198944008 241776546 303241228 324255699 332040645 421137808 456244828 490270492 558938166 568148916 571606906 602989312 675719954 792032281 839138719 931603250

View File

@ -0,0 +1,46 @@
#include <algorithm>
#include <cstdlib>
#include <iomanip>
#include <ios>
#include <iostream>
#include <set>
typedef long long ll;
const ll max_n = 1e5+5;
ll n, q, input,num;
char c;
std::set<ll> pos;
#define NV(v)#v<<" : "<<(v)
int main(){
freopen("secret.in", "r", stdin);
freopen("secret.out", "w", stdout);
std::cin>>n>>q;
for(ll _{0};_<n;_++){
std::cin>>input;
pos.insert(input);
}
for(ll _{0};_<q;_++){
std::cin>>c>>num;
if(c=='+'){
pos.insert(num);
}else if(c=='-'){
pos.erase(num);
}else{
// for(auto i:pos){
// std::cout<<i<<' ';
// }
// std::cout<<'\n';
// std::cout<<NV((double)*pos.begin())<<"\n"<<NV((double)*(--pos.end()))<<'\n'<<NV((double)num)<<'\n'<<NV(num)<<'\n';
const double left {std::abs((double)num-(double)*pos.begin())}, right{std::abs((double)*(pos.rbegin())-(double)num)};
// auto it = pos.find(num);
// auto left_it = it,right_it = it;
// std::cout<<NV(left)<<" "<<NV(right)<<'\n'<<NV(num)<<'\n';
std::cout<<std::fixed<<std::setprecision(2)<<(left+right)/2<<'\n';
}
}
}

View File

@ -0,0 +1,3 @@
2.00
2.00
1.50

View File

@ -0,0 +1,8 @@
3 6
1 3 5
? 3
- 3
? 5
+ 2
+ 4
? 2

View File

@ -0,0 +1,10 @@
349842299.50
388849076.00
331465917.00
433424616.50
268749588.00
489709832.00
374701703.00
419274612.00
498601383.50
352454458.00

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,327 @@
463613902.00
430172414.00
277781859.00
489259248.00
468037697.00
480444122.50
368443705.00
317027745.00
361844436.00
327595340.50
292515215.50
273071819.00
298828579.00
341303215.50
494493411.50
383073574.50
445752351.00
346615841.50
372731159.50
486130603.00
355688046.50
493063092.50
403204169.50
479493203.50
417374176.00
415021064.00
386895552.50
402447125.00
350932555.00
419674672.00
461623568.00
452518056.00
355237945.00
477792460.00
472024528.00
445195187.00
317960107.50
389679085.00
438155284.00
359201852.50
403694620.50
463939803.50
283070748.00
441873116.50
328529819.50
324038560.00
380068803.00
424246187.50
417080650.00
360967022.00
310091567.50
289994509.50
450149095.00
326398814.50
285710003.50
293951229.00
259642247.50
459701773.50
353772107.50
407011221.00
263736637.00
414193127.50
302201485.00
442683554.00
399408719.50
319759013.00
456408895.50
255756214.00
333721518.00
329888533.50
408777678.00
432884841.00
398283537.00
315787653.00
377642018.00
463428080.00
445161787.00
455810822.50
267864284.00
254226742.50
244208264.00
413594184.00
429903811.00
450494383.50
371024246.50
347413911.00
438799373.00
298959479.00
477691757.50
407538963.00
363958202.00
477445666.00
465718790.00
278732814.50
283525004.50
286638096.00
427906526.00
458523736.50
350603892.00
476306630.00
260062087.00
249076346.00
449347459.00
244022515.50
462894012.50
367053016.00
383310928.50
384414627.00
325896026.00
350637459.00
283591282.00
475412934.50
272473722.00
282109377.50
288114721.00
448902577.00
287985879.50
456032542.00
379254685.00
349777074.50
362954944.00
250363953.50
295898452.00
426473584.00
477637786.50
353709469.50
401947461.00
462964345.50
427908155.00
309908642.00
342031416.00
342221300.00
308297416.00
353921125.50
396210676.00
367434517.50
368872529.00
471868648.00
451565733.50
369512459.00
348019337.50
428885913.50
395434427.00
435054846.50
339351046.00
254411869.50
439164378.00
311276657.50
376312511.50
367258711.50
450435119.00
243902862.00
369181149.50
419367027.50
369181149.50
349163332.00
354785009.50
391373594.00
384913423.00
411612667.00
329213708.00
265271960.00
433438118.00
410575319.00
462811804.50
462811804.50
417406548.00
431058411.50
323497888.00
288155018.50
395906964.50
321241597.00
413327491.50
414243989.00
316211284.00
340164849.00
271374475.00
429153106.50
364224012.00
300500570.00
459922822.50
251198950.00
241371113.00
375415476.50
250987759.50
361081663.50
388412552.50
249610229.50
363200189.50
413228884.50
238175561.50
457292006.00
288721190.00
382470819.50
322067782.00
305411585.50
368196479.00
396848020.50
379593618.50
413113535.50
359403590.00
409978655.50
455668883.50
407021657.50
414272905.50
373336541.50
311836902.50
230458937.50
409202079.00
285799676.00
238064550.50
453774311.50
280852080.50
267393741.00
298423907.00
370521581.50
398118191.00
246880090.00
309694489.00
244695301.50
238904836.50
451473489.00
451473489.00
332848604.50
389898250.50
267511690.50
340448528.00
264549728.50
281680013.50
413854489.50
314721516.50
308264706.50
447774817.00
382399375.00
322625181.50
434879383.00
310306382.00
282892996.50
226186874.00
323862829.00
363129223.00
381338663.00
345881361.00
248894658.00
437096955.00
245308726.00
263663483.00
371487291.00
446531226.50
293021235.50
305589088.50
443506064.00
348741066.00
334344148.50
330851972.50
445078465.00
332202869.50
359953130.50
445143265.50
385195078.00
295522210.50
287120263.50
228646691.50
324483086.50
363381309.00
292301053.50
394618156.00
378582962.50
405804038.00
442704101.00
422482958.00
460233182.00
442704101.00
423489050.00
441580768.00
441580768.00
308703672.50
415340758.00
316162307.00
264795667.00
379521684.50
325998263.50
424117436.50
254944815.50
292491269.50
400896866.00
241689756.50
247252228.50
348809003.50
425214849.50
421637544.50
258914130.50
445146048.00
353672510.50
456856506.00
450687913.00
340590831.50
361694831.00
370113977.50
284512997.50
446092853.00
264056620.00
258935174.50
397897068.00
416188713.50
338598210.00
254730171.50
308412102.00
217923335.00
337548372.50
434315426.00
367204122.00
230179886.00
273105644.50
444082224.50
252651566.00
280366031.50
270987109.00
453461573.00
452415711.50
375497808.50
368462710.00
433269564.50
273759071.00
312937864.50
251698527.50
439727083.50

File diff suppressed because one or more lines are too long