How much you are expecting??

Active In

Indian Computing Olympiad (ICO)

Competitive Programming

International Olympiad in Informatics

International Physics Olympiad

CP noobs

International Chemistry Olympiad

Algorithms and Computer Programming

Featured Contributions

reply in this discussion

reply in this discussion

reply in this discussion

reply in this discussion

reply in this discussion

reply in this discussion

Jee Va1y

#include <iostream>using namespace std;int n;void arrange(int X[]){for(int i=0;i<n;i++)for(int i=0;i<n-1;i++)X[i]>X[i+1]? swap(X[i],X[i+1]): swap(X[i],X[i]);}int main(){int K;cin>>n>>K;int A[n],B[n];for(int i=0;i<n;i++){cin>>A[i];}for(int i=0;i<n;i++){cin>>B[i];}arrange(A);arrange(B);

Read more… (5 words)

reply in this discussion

Jee Va1y

Thanks! I used a different logic and got it right!

#include <iostream>using namespace std;int N;int main(){cin>>N;int S[N],T[N],a,b,win,lead;cin>>a>>b;S[0]=a;T[0]=b;if(a-b>0){lead=a-b;win=1;}else{lead=b-a;win=2;}for(int i=1;i<N;i++){cin>>a>>b;S[i]=S[i-1]+a;T[i]=T[i-1]+b;if(S[i]-T[i]>lead){win=1;

Read more… (10 words)