Submission

Status:

[P-SSS][-SSSS]

Subtask/Task Score:

{0/50}{0/50}

Score: 0

User: qweqwe

Problemset: จุดแวะพัก

Language: cpp

Time: 0.008 second

Submitted On: 2025-10-21 19:43:26

#include <bits/stdc++.h>
#define speed cin.tie(0)->sync_with_stdio(0)
#define ll long long
#define pii pair<int,int>
using namespace std;

bool isint(const string &n){
	if (n.empty()) return false;
	for (char c:n){
		if (c-'0'<0 || c-'0'>9) return false;
	}return true;
}

int main(){
	speed;
	int n,k;cin >> n >> k;
	cin.ignore();
	vector<pair<ll,string>> v;
	string s;
	for (int i=0;i<n;i++){ // i understand it now
		int j=0;
		string input,t; // a bit odd?
		getline(cin,input); // alr i got ts
		stringstream cinn(input); // brother wth is this???
		while (cinn >> t){
			if (!isint(t)){
				s=t;
			}else{
				int temp=stoi(t);
				if (temp==k){
					v.push_back({j,s});
				}j++;
			}
		}
	}sort(v.begin(),v.end());
	for (pair<ll,string> i:v){
		cout << i.second << " ";
	}
	return 0;
}