Submission
Status:
[PP-SS][-SSSS]
Subtask/Task Score:
{0/50}{0/50}
Score: 0
User: Punzaza123
Problemset: จุดแวะพัก
Language: cpp
Time: 0.007 second
Submitted On: 2026-10-05 10:48:23
#include <bits/stdc++.h>
using namespace std;
int main(){
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
vector <char> test = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
vector <pair<int,string>> person;
bool hee = true;
int n, k, a, pun;
string input, temp;
cin >> n >> k;
for(int i = 0; i < n; i++){
while(true){
cin >> input;
if(count(test.begin(), test.end(), input[0]) >= 1){
if(stoi(input) == k && hee == true){ person.push_back({pun, temp}); hee = false; }
else{ pun++; }
}
else{
temp = input;
break;
}
}
hee = true;
pun = 0;
}
sort(person.begin(), person.end());
if(person.empty()){ cout << "-1"; return 0; }
for(int i = 0; i < person.size(); i++){
cout << person[i].second << " ";
}
return 0;
}