Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
runtime error???#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator