Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.005 s | 1 KBi |
#2 |
Correcto
|
0.005 s | 1 KBi |
#3 |
Correcto
|
0.005 s | 1 KBi |
#4 |
Correcto
|
0.005 s | 1 KBi |
#5 |
Correcto
|
0.005 s | 1 KBi |
#6 |
Correcto
|
0.005 s | 1 KBi |
#7 |
Correcto
|
0.005 s | 1 KBi |
#8 |
Correcto
|
0.006 s | 1 KBi |
#9 |
Correcto
|
0.006 s | 1 KBi |
#10 |
Correcto
|
0.006 s | 1 KBi |
#11 |
Correcto
|
0.005 s | 1 KBi |
#12 |
Correcto
|
0.006 s | 1 KBi |
#13 |
Correcto
|
0.004 s | 1 KBi |
#14 |
Correcto
|
0.005 s | 1 KBi |
#15 |
Correcto
|
0.006 s | 1 KBi |
#16 |
Correcto
|
0.005 s | 1 KBi |
#17 |
Correcto
|
0.005 s | 1 KBi |
#18 |
Correcto
|
0.006 s | 1 KBi |
#19 |
Correcto
|
0.004 s | 1 KBi |
#20 |
Correcto
|
0.005 s | 1 KBi |
#21 |
Correcto
|
0.007 s | 1 KBi |
#22 |
Correcto
|
0.005 s | 1 KBi |
#23 |
Correcto
|
0.004 s | 1 KBi |
#24 |
Correcto
|
0.006 s | 1 KBi |
#25 |
Correcto
|
0.006 s | 1 KBi |
#26 |
Correcto
|
0.006 s | 1 KBi |
#27 |
Correcto
|
0.005 s | 1 KBi |
#28 |
Correcto
|
0.006 s | 1 KBi |
#29 |
Correcto
|
0.005 s | 1 KBi |
#30 |
Correcto
|
0.005 s | 1 KBi |
#31 |
Correcto
|
0.005 s | 1 KBi |
#32 |
Correcto
|
0.006 s | 1 KBi |
#33 |
Correcto
|
0.005 s | 1 KBi |
#34 |
Correcto
|
0.005 s | 1 KBi |
#include <bits/stdc++.h> #define IO ios_base::sync_with_stdio(false), cin.tie(nullptr) #define endl '\n' using namespace std; long long go(vector<int> &a, vector<int> &b, int k, int l, int i, int j, set<int> &s, long long acum){ if(k<=0)return acum; long long res = 0; s.insert(b[i]); acum += b[i]; if(s.size()>l){acum-=*s.begin();s.erase(s.begin());} res = max(res,a[i]+go(a,b,k-1,l,i+1,j,s,acum)); s.erase(b[i]); acum-=b[i]; s.insert(b[j]); acum += b[j]; if(s.size()>l)s.erase(s.begin()); res = max(res,b[i]+go(a,b,k-1,l,i,j-1,s,acum)); s.erase(b[j]); acum -= b[j]; return res; } int main(){ IO;/* int n;cin>>n; vector<int> a(n+1),b(n+1); for(int i=1;i<=n;i++)cin>>a[i]; for(int i=1;i<=n;i++)cin>>b[i]; int k,l;cin>>k>>l; set<int> s; cout<<go(a,b,k,l,1,n,s,0)<<endl; */ string s;cin>>s; int i = s.size()-1; while(s[i]=='9'){ s[i] = '0'; i--; } if(i==-1) { cout << '1' + s << endl; } else{ s[i] = s[i]+1; cout<<s<<endl; } return 0; }