Submission
Status:
[P-SSS][PPP-S]
Subtask/Task Score:
{0/50}{0/50}
Score: 0
User: Quaoar
Problemset: จุดแวะพัก
Language: cpp
Time: 0.007 second
Submitted On: 2025-11-24 14:02:00
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <sstream>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
std::vector<std::pair<int, string>> nc;
int n , k , num;
int cnt = 0;
string name;
cin >> n >> k;
n++;
for (int i = 0 ; i < n ; i++){
string line;
getline(cin, line);
stringstream ss(line);
ss >> name;
bool smth = false;
while (ss >> num){
if (num == k) {
smth = true;
break;
} else if (num > k){
break;
}
cnt++;
}
if (!smth){
cnt = 1e5;
}
nc.push_back(make_pair(cnt, name));
//cout << name << " " << cnt << "\n";
cnt = 0;
}
sort(nc.begin(), nc.end());
cout << nc[0].second << " " << nc[1].second << " " << nc[2].second;
}