### Saratov State University :: Online Contester

::Go
- home
- news
- register
 - update personal info
 - problemset archive
- submit
- status online
- standing
- contests
- virtual contests
- forum
- statistic
- FAQ
- links
- projects

 ::Poll Are you registered on Codeforces?YesNoWhat is it???[results]

::webboard

 wrong answer on test case 3
Author: s512
ID: 062068
Problem: 199
Contest: 0
Date: 2014-05-25 12:13:34

#include<stdio.h>
struct data {
long long int a;
long long int b;
int o;
};

int compare(struct data *elem1, struct data *elem2)
{
if ( elem1->a < elem2->a)
return -1;

else if (elem1->a > elem2->a)
return 1;

else
return 0;
}

void max(struct data arr[],int mcl[],int n,int pos[]) {

int i, j, max = 1;

for ( i = 0; i < n; i++ )
mcl[i] = 1;

for ( i = 1; i < n; i++ ){
for ( j = 0; j < i; j++ ){
if ( (arr[i].a>arr[j].a&&arr[i].b>arr[j].b)&& mcl[i] < mcl[j] + 1) {

mcl[i] = mcl[j] + 1;
pos[arr[j].o+1]=1; }}
if(max<mcl[i]){
max=mcl[i];
pos[arr[i].o+1]=1;}}

if(max==1) printf("%dn%d",1,1);
else{
printf("%dn",max);
for(i=0;i<n+1;i++){ if(pos[i]==1) printf("%d ",i);}
}

}

int main () {
int n,i;
scanf("%d",&n);
struct data arr[n];
int mcl[n],pos[n+1];
for(i=0;i<=n;i++) pos[i]=0;
for(i=0;i<n;i++){ scanf("%lld%lld",&arr[i].a,&arr[i].b); arr[i].o=i;}
qsort(arr,n,sizeof(struct data),compare);
max(arr,mcl,n,pos);
return 0;
}

 ::Login form.login input{margin:2px;font-size:10px;} your id: password: Forgot password?

 ::News 22.10.12 - The problems from the Southern Subregional Programming Contest 2012 added to the problemset archive (542 - 553). 22.10.12 - After the start of the contest the statements in PDF will be available by the link.23.10.11 - The problems from the Southern Subregional Programming Contest 2011 added to the problemset archive (530 - 541).

::Counter

 Server time: 2018-02-20 16:40:57 Online Contester Team © 2002 - 2016. All rights reserved.