Submission

Status:

[-SSSS][-SSSS]

Subtask/Task Score:

{0/50}{0/50}

Score: 0

User: achinhchin

Problemset: จุดแวะพัก

Language: cpp

Time: 0.007 second

Submitted On: 2025-11-26 15:09:02

#include<bits/stdc++.h>
using namespace std;
typedef long long l;
#define pl pair<l,l>
#define plp pair<l,pl>
#define f first
#define s second
pl D[]={{0,1},{1,1},{0,-1},{-1,1},{1,0},{-1,-1},{-1,0},{1,-1}};
l i,j,k,n,a,b,c,sm,mx,mn,t2;
vector<pair<l,string>> A;
string t,t1;
int main() {
  cin.tie(nullptr)->sync_with_stdio(0);
  cin>>n>>k;
  cout<<'\n';
  while(n--){
    getline(cin,t);stringstream ss(t);ss>>t1;
    for(i=0;ss>>t2;i++)if(t2==k)A.push_back({i,t1});
  }sort(A.begin(),A.end());if(A.empty()){cout<<-1;return 0;}
  for(auto i:A)cout<<i.s<<' ';
}