CodeForces Div 3 #598

Does anyody know why is Codeforces down? When it would be up again? It hanged around 1 hour after contest starting…

m2.codeforces.com was working though, I was functional for the entire duration

1 Like

Yes,The site was down but asking such questions and creating unnecessary posts is not fruitful to others and I think no one would know why it was down?:stuck_out_tongue_closed_eyes::stuck_out_tongue_closed_eyes:
Don’t Take it otherwise bro

4 Likes

Codechef is the only programming site that has other codeforces participants also. I think this is a genuine platform to ask questions. regarding this.

Codeforces is working perfectly on Microsoft Edge

1 Like

it is up again now

2 Likes

#include<bits/stdc++.h>
using namespace std;

int find_min_ind(int arr[],int l,int r)
{
int minn=l;
for(int i=l+1;i<=r;i++)
{
if(arr[i]<arr[minn])
{
minn=i;
}
}

return minn;

}

void fun(int arr[],int n)
{
int left=0,right=n-1;
int count=0;
int i=find_min_ind(arr, left, right);
while(count<n-1)
{

    if(i!=0 && arr[i]!=i+1)
    {
        swap(arr[i],arr[i-1]);
        i=i-1;
        count++;
        
    }
    else
    {
        if(left<right)
        	i=find_min_ind(arr,left+1, right);
        
    }
   
}

for(int i=0;i<n;i++)
{
    cout<<arr[i]<<" ";
}
cout<<endl;

}
int main()
{
int q;
cin>>q;

while(q--)
{
    int n;
    cin>>n;
    
    int arr[n];
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    if(n==1)
    {
        cout<<arr[0]<<endl;
    }
    else
    {
    
    
        fun(arr,n);
    }
    
    
    
    
}
return 0;

}

anyone explain why it is showing tle for B problem