Moderator: Board moderators

removed
#include<iostream.h>
#include<fstream.h>
void main(){
// ifstream cin("a.in");
long long dayno,sum,max1,max2,min1,min2,bill,I,K,n;
cin>>dayno;
while(dayno>0){
sum=0;
max1=max2=0;
min1=min2=1000001;
for(I=0;I<dayno;I++){
cin>>n;
for(K=0;K<n;K++){
cin>>bill;
if(bill>max1){
max2=max1;
max1=bill;
}else if(bill>max2)
max2=bill;
if(bill<min1){
min2=min1;
min1=bill;
}else if(bill<min2)
min2=bill;
}
sum+=max1-min1;
max1=max2;
max2=0;
min1=min2;
min2=0;
}
cout<<sum<<endl;
cin>>dayno;
}
}
StanleY Yelnats wrote:I used two priority queue however it was a WA
but the algorithm seems to be ok, i'm still working on it
( WA in 2.2sec )
/*11136*/
Removed after AC
tzupengwang wrote:
- Code: Select all
multiset<long long int> m;

Users browsing this forum: No registered users and 1 guest