Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as C++ by kovalyovlight ( 15 years ago )
#include <stdio.h>
#include <stdlib.h>
/* int sort(const void* x, const void* y)
{
return (*(int*)x - *(int*)y);
}
*/
int main()
{
struct ner{int type,v;};
ner a[100000];
int y,x,max,n,i,pr,count,count1,min;
int b[100000];
//FILE* f=fopen("inequality.in","r");
//fscanf(f,"%d",&n);
//for (i=0; i<n; i++)
//{fscanf(f,"%d%d",&a[i].type,&a[i].v); if (a[i].type==1) a[i].v++; if (a[i].type==2) a[i].v--; }
//qsort(a,n,sizeof(int),sort);
/*count=0; count1=0;
pr=a[n-1].v; x=a[n-1].v; y=0; max=-1000000;
for (i=0;i<n;i++)
{if (pr!=a[i].v) count1=0;
pr=a[i].v;
switch (a[i].type)
{case 1: count++; break;
case 2: count--; break;
case 3: count1++; break;
case 4: count1--; break;}
b[i]=count+count1;
//if (count+count1>=max) {x=a[i].v; y=max;}
}
min=1000000;
max=-1000000;
for (i=0; i<n; i++) if (b[i]<min) min=b[i];
for (i=0; i<n;i++) if (b[i]-min>max) {max=b[i];x=a[i].v;}
printf("%d %d",x,max); */
//fclose(f);
return 0;
}
Revise this Paste