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

这么弱的数据,怎么竟然还要47s?

Posted by KatrineYang at 2016-07-02 23:27:26 on Problem 2028
//============================================================================
// Name        : main2028.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;

int main() {
	int N, Quo;
	while(1){
		cin >> N >> Quo;
		if(N==0 && Quo==0) return 0;
		int num[128] = {0};
		for(int i = 0; i < N; i++){
			int rubbish;
			cin >> rubbish;
			for(int j = 0; j < rubbish; j++){
				int temp;
				cin >> temp;
				num[temp]++;
			}
		}
		int res;
		int max = 0;
		bool can = false;
		for(int i = 1; i < 128; i++){
			if(num[i] >= Quo && num[i] > max){
				can = true;
				max = num[i];
				res = i;
				//break;
			}
		}
		if(can) cout << res << endl;
		else cout << 0 << endl;
	}
	//cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
	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