Submission
Status:
[PPPPP][PPPPP]
Subtask/Task Score:
{50/50}{50/50}
Score: 100
User: tull
Problemset: จุดแวะพัก
Language: cpp
Time: 0.011 second
Submitted On: 2026-06-02 23:44:44
#pragma GCC optimize("O3,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define bp '\n'
#define ld long double
#define vp cout<<'\n';
#define all(A) A.begin(),A.end()
using pii=pair<int,int>;
const int MOD=1e9+7;
const int MNLL=-1e18;
const int MXLL=1e18;
const int N=2e5+10;
const string sans[]={"NO","YES"};
signed main(){
cin.tie(nullptr)->sync_with_stdio(false);
int n,K;
cin>>n>>K;
vector<pair<int,string>>a;
for(int i=0;i<n;++i){
int cnt=0,fnd=0,x;
string k;
cin>>k;
while(cin>>x){
if(!fnd)++cnt;
if(x==K)fnd=1;
} cin.clear();
if(fnd){
a.emplace_back(make_pair(cnt,k));
}
}
sort(all(a));
for(int i=0;i<min((int)a.size(),3);++i){
cout<<a[i].second<<' ';
}
if(a.empty())cout<<-1;
}
/*
5 7
taohu 0 1 7 9
mafuyu 2 5
ccsleep 2 4 7 25
sira 7
iris 32 64 128
*/