Mapas: Cerr Visited (I) (J) " " ) Cerr Endl )
Mapas: Cerr Visited (I) (J) " " ) Cerr Endl )
Ejerd J
#include <bits/stdc++.h> #include <bits/stdc++.h>
using namespace std; #define debug1(A) if(debug)
int main () { {cerr<<#A<<" :"<<A<<endl;}
string s; bool debug={1};
int j; #define fore(i,a,b) for (auto i = a; i < b; i++)
cin>>j; using namespace std;
for(int k =0; k<j ; k++){ bool ok(int act, int l){
cin>>s; if(act>0 && act< l+1){ return
int n; true; }else{ return false; }
n=s.size(); }
vector<int>dp(n+1); int main(){
if(s[0]==s[1]){ dp[0]=1; }else{ dp[0]=2; } int l,m,n,comer;
cin>>n;
if(s[n-1]==s[n-2]){dp[n-1]=1;}else{dp[n- cin>>m;
1]=2;} cin>>l;
cin>>comer;
for( int i=1 ; i< n-1; i++ ){ int vec[l+2]={};
if(s[i]==s[i-1] || s[i]==s[i+1] ){ int h;
dp[i]=1; for (int i = 0; i < comer; i++){
}else{dp[i]==2;} cin>>h;
} vec[h]=1;
for(int i=0; i<n; i++){ }
if(dp[i]==1) vector<int>visit(l+2,0);
{cout<<s[i];}else{cout<<s[i]<<s[i];} queue<int>q;
} q.push(0);
cout<<endl; visit[0]=1;
} int ans=0;
} while (q.size()){
int act=q.front();
debug1(act) }
// cout<<" actual "<<act<<endl; cout<<endl;
q.pop();
if(vec[act]){ans++;} }
if(ok( act +n,l) && !visit[act+n] ){
q.push(act+n);
visit[act+n]=1;
}
if(ok( act -m,l) && !visit[act-m] ){
q.push(act-m);
visit[act-m]=1;
}
debug1(q.size())
}
cout<<ans<<endl;
fore(i, 0,3){ debug1(ans)}
}
Po
#include <iostream>
using namespace std;
void insercion(int arreglo[], int n){
for(int i=1; i<n; i++){
int j=i;
while(j>0 && arreglo[j]<arreglo[j-1]){
swap(arreglo[j],arreglo[j-1]);j--;
}
}
}
void shell(int arreglo[], int n){
for (int k = n/2; k >0 ; k=k/2){
for(int i=k; i<n; i++){
int j=i;
while(j>=k && arreglo[j-k]>arreglo[j]){
swap(arreglo[j],arreglo[j-k]);j=j-k;
}
}
}
}
int main(){
int n;
cin>>n;
int arreglo[n];
for (int i = 0; i < n; i++){
arreglo[i]=rand()%100+1;
}
shell(arreglo,n);
for (int i = 0; i < n; i++)
{
cout<<arreglo[i]<<" ";