Mai intai trebuie sa te autentifici.
Cod sursa(job #163639)
Utilizator | Data | 22 martie 2008 14:50:51 | |
---|---|---|---|
Problema | Marbles | Scor | 50 |
Compilator | cpp | Status | done |
Runda | preONI 2008, Runda Finala, Clasele 5-8 | Marime | 0.63 kb |
#include<stdio.h>
struct bila
{
long a,b;
};
bila c[10000];
long tip,k,n,m,i,j,h,max,f[65];
int main()
{
freopen("marbles.in","r",stdin);
freopen("marbles.out","w",stdout);
scanf("%ld %ld",&n,&m);
for(i=1;i<=n;++i)
scanf("%ld%ld",&c[i].a,&c[i].b);
for(k=1;k<=m;++k)
{
scanf("%ld%ld%ld",&tip,&i,&j);
if(tip==0)
{
for(h=1;h<=n;++h)
if(c[h].a==i) c[h].a+=j;
}
if(tip==1)
{
for(h=1;h<=64;++h)
f[h]=0;
max=0;
for(h=1;h<=n;++h)
if(c[h].a>=i&&c[h].a<=j) {f[c[h].b]++; if(f[c[h].b]>max) max=f[c[h].b];}
printf("%ld\n",max);
}
}
return 0;
}