Submission

Status:

[P-SSS][-SSSS]

Subtask/Task Score:

{0/50}{0/50}

Score: 0

User: Seng

Problemset: จุดแวะพัก

Language: cpp

Time: 0.003 second

Submitted On: 2026-05-26 23:31:52

#include <bits/stdc++.h>
using namespace std;
using pir = pair<int, string>;
int main(){
	ios::sync_with_stdio(0);cin.tie(0);
	int n, k;cin >> n >> k;	
	priority_queue<pir, vector<pir>, greater<pir>> ans;
	int ss = 0;
	string str2;cin >> str2;
	while(n--){
		string str = str2;
		int cnt = 0;
		bool chk = false;
		int x;cin >> x;
		str2 = '1';
		while('9' - str2[0] >= 0){
			
			if(x < k) cnt++;
			else if(x == k){
				ans.push({cnt, str});
				ss++;
				chk = true;
			} 
			else chk = true;
			
			if((n == 0 && x >= k) || ss >= 3){
				ss = min(3, ss);
				while(ss--){
					string ansstr = ans.top().second;
					ans.pop();
					cout << ansstr << " ";
				}		
				return 0;
			} 
			
			cin >> str2;
			x = str2[0]-'0';
		}
		
		//cout << cnt << " " << str << '\n';
		
	}
	
	
}