diff --git a/src/P1030/P1030.cpp b/src/P1030/P1030.cpp index dbbd85e..8dac354 100644 --- a/src/P1030/P1030.cpp +++ b/src/P1030/P1030.cpp @@ -1 +1,35 @@ -int main(){} \ No newline at end of file +#include +#include +#include + +using ll = long long; + +auto &is = std::cin; +auto &os = std::cout; + +std::string m, r; + +void dfs(const std::string_view &sv)noexcept{ + if(sv.size()==0){ + return; + } + ll max_rpos{}; + for(auto &i:sv){ + max_rpos = std::max((ll)r.find(i),max_rpos); + } + + const ll sv_root_pos{(ll)sv.find(r[max_rpos])}; + + os<>m>>r; + os< +#include +#include + +using ll = long long; + +ll n,a,b,ans; + +struct ReadLL{ + char c; + ll n,w; + ReadLL&operator>>(ll &num)noexcept{ + c=0,n=0,w=1; + while(!isdigit(c)){ + if(c=='-')w=-1; + c=getchar(); + } + while(isdigit(c)){ + n=n*10+c-'0'; + c=getchar(); + } + num=n*w; + return *this; + } +}readll; + +// auto &is = std::cin; +auto &is = readll; +auto &os = std::cout; + +int main(){ + is>>n; + for(ll i{0};i!=n;i++){ + is>>b; + if(b>a){ + ans+=b-a; + } + a=b; + } + os<