ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Common Board

To MARAT BAKIROV or someone else from timus.....
Posted by Vladimir Milenov Vasilev 19 Mar 2002 18:12
I think, something's wrong with your test programs.Have a look at
program 1203...I got it accepted using PASCAl. Here is the same
algorithm, written on C++.Will you, please, give me contra test -
that my program get's "Wrong Answer"??? I could not get accepted with
this source....
HEre it is..
------------------------------------------
#include <stdio.h>
const int max=30001;
const long max2=100001;
long a[max];
int x[max2];
void main(){
int y;
long n,br,i;
for(i=0;i<max;i++) a[i]=0;
scanf("%ld",&n);
for(i=0;i<n;i++){
    scanf("%d%d",&x[i],&y);
    if (a[y]==0) a[y]=i+1;
    else if(x[a[i]-1]<x[i]) a[y]=i+1;
   }
br=0;
y=0;
for(i=0;i<max;i++)
 if (a[i])
  if(x[a[i]-1]>y) {br++;y=i;}
printf("%ld\n",br);
}
-------------------------------------------------------
THANK YOU!!!!!