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

runtime error???

Posted by cdschenshuai at 2009-02-17 21:29:41 on Problem 1065
#include <iostream>
using namespace std;

int a[20],b[100],c[100],d[20],n,i,j,k;
int temp;

int main()
{
    while (cin >> n){
		for(i = 0; i < n; ++i){
			cin >> a[i];
			for(j = 0; j < a[i]; ++j){
				cin >> b[j] >> c[j];
			}

			for(j = 0; j < a[i]; ++j){
				for(k = j; k < a[i]; ++k){
					if(b[k] < b[j] && c[k] < c[j])
					{
                        temp = b[j]; b[j] = b[k]; b[k] = temp;
						temp = c[j]; c[j] = c[k]; c[k] = temp;
					}
				}
            }    
			for(j = 0; j < a[i] - 1; ++j){
				if(!(b[j+1] >= b[j] && c[j+1] >= c[j]))
					d[i]++;
			}
		}
		for(i = 0; i < n; ++i)
	    	cout << d[i] + 1 <<endl;
	}
	return 0;
}

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