Submission
Status:
[PPPTS][PPxSS]
Subtask/Task Score:
{0/50}{0/50}
Score: 0
User: sakurajima
Problemset: จุดแวะพัก
Language: cpp
Time: 1.042 second
Submitted On: 2026-10-05 10:45:56
#include <bits/stdc++.h>
using namespace std;
int main() {
int n,k;
cin >> n >> k;
cin.ignore();
vector<pair<int, string>> soln;
for (int i = 0; i < n; i++) {
string line;
getline(cin, line);
stringstream ss(line);
string name;
ss >> name;
int x;
int count = 0;
while (ss >> x) {
if (x < k) {
count++;
}
else if (x == k) {
soln.push_back({count, name});
}
else {
continue;
}
}
}
sort(soln.begin(), soln.end());
if (soln.empty()) {
cout << -1;
return 0;
}
for (int i = 0; i < 3; i++) {
cout << soln[i].second << " ";
} cout << '\n';
}