Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Why wrong answer?

Posted by ACM06021fly at 2006-07-30 17:43:02 on Problem 2893
#include<stdio.h>

int data[1000000];
int main()
{
	int m,n,i,j;
	while(scanf("%d %d",&m,&n)==2){
		if(!m && !n)
			return 0;
		for(i = 0; i < m*n; i++)
				scanf("%d",&data[i]);
			int ni = 0;
			for(i = 0; i < m*n-1; i++)
				for(j = i+1; j < m*n; j++)
					if(data[i] > data[j] && data[j] != 0)
						ni++;
			if(ni%2 == 0)
				printf("YES\n");
			else
				printf("NO\n");
	}
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator