Submission #1082910

#TimeUsernameProblemLanguageResultExecution timeMemory
1082910owoovoHomework (CEOI22_homework)C++17
100 / 100
168 ms117072 KiB
#include<bits/stdc++.h> #define pii pair<int,pair<int,int>> #define ll long long #define F first #define S second using namespace std; pii rd(){ char c; cin>>c; if(c=='?'){ return {1,{1,1}};//len l r 1base; }else{ cin>>c; pii x,y; pii ans; if(c=='i'){//min cin>>c>>c; x=rd(); cin>>c; y=rd(); ans.F=x.F+y.F; ans.S.F=min(x.S.F,y.S.F); ans.S.S=x.S.S+y.S.S-1; }else{//max cin>>c>>c; x=rd(); cin>>c; y=rd(); ans.F=x.F+y.F; ans.S.F=x.S.F+y.S.F; ans.S.S=max(x.F+y.S.S,x.S.S+y.F); } cin>>c; return ans; } } int main(){ ios::sync_with_stdio(0); cin.tie(0); pii ans=rd(); cout<<ans.S.S-ans.S.F+1<<"\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...