Created
November 16, 2014 08:06
-
-
Save lp6m/27ababba7dd05f604c99 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <algorithm> | |
#include <vector> | |
#include <stack> | |
#include <queue> | |
#include <map> | |
#include <cmath> | |
#include <string> | |
#include <sstream> | |
#include <iomanip> | |
#include <complex> | |
using namespace std; | |
#define ll long long | |
#define vvi vector< vector<int> > | |
#define All(X) X.begin(),X.end() | |
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++) | |
#define REP(i,n) for(int i=0;i<(int)(n);i++) | |
#define pb push_back | |
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;} | |
ll lcm(ll a,ll b){return a/gcd(a,b)*b;} | |
int data[200]; | |
int main(){ | |
int n,q; | |
while(1){ | |
cin >> n >> q; | |
if(n==0&&q==0) return 0; | |
REP(i,200) data[i] = 0; | |
REP(i,n){ | |
int tmp; | |
cin >> tmp; | |
REP(j,tmp){ | |
int t2; | |
cin >> t2; | |
data[t2]++; | |
} | |
} | |
int ans = 0; | |
int pnum = 0; | |
REP(i,200){ | |
if(data[i]>=q){ | |
if(pnum<data[i]){ | |
ans = i; | |
pnum = data[i]; | |
} | |
} | |
} | |
cout << ans << endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment