Why is this problem not present on codechef???
i fixed ,my own code to this extend ,but same test cases are not passing..
plzz... help
#include<iostream>#include<algorithm>using namespace std;int ans(long long int b[],long long c[],long long int n1,long long int k1){while(k1){sort(b,b+n1);sort(c,c+n1);if(b[n1-1] > c[n1-1]){if(b[0] < c[n1-1]){swap(b[0],c[n1-1]);
I have implemented ,according to your hints, still iam getting many tle and wa.
#include<iostream>#include<algorithm>using namespace std;int partition(int*,int,int);void qs(int books[],int low,int high){if(low<high){int j;j = partition(books,low,high);qs(books,low,j-1);qs(books,j+1,high);}}int partition(int book[],int low1,int high1){int key,i,j;key = book[low1];i = low1 + 1;j = high1;while(1){while(key >= book[i])i++;
i rectified the code. Still it is getting partially accepted.
#include<iostream>#include<stack>using namespace std;int main(){bool pop_=false;int c=0,lp=0,dp=0,ml=0,d=0,p=0,mlmax=0,dmax=0;stack<int> bracket;long long n,j=0;cin>>n;long long int a[n];for(long long int i=0;i<n;i++)cin>>a[i];while(n!=0){if(a[j]==1){bracket.push(1);p++;ml++;if(!pop_){
Why is this solution getting partially accepted??
plzzzz help.
thank you!!
#include<iostream>#include<stack>using namespace std;int main(){bool pop_=false;int c=0,lp=0,dp=0,ml=0,d=0,p=0,mlmax=0,dmax=0,a[500000],n,j=0;stack<int> bracket;cin>>n;for(int i=0;i<n;i++)cin>>a[i];while(n!=0){if(a[j]==1){