Submission
Status:
Compilation Error
Subtask/Task Score:
Score: 0
User: Seng
Problemset: จุดแวะพัก
Language: cpp
Time: 0.000 second
Submitted On: 2026-05-31 22:09:49
#include <bits/stdc++.h>
using namespace std;
using pis = pair<int, string>;
int main(){
ios::sync_with_stdio(0);cin.tie(0);
int n, k;cin >> n >> k;
string str;cin >> str;
string str2 = str;
priority_queue<pis, vector<pis>, greater<pis>> pq;
while(n--){
str = str2;
int x = 0, cnt = 0;
bool chk = false
if(n > 0){
cin >> x;
while('9' - str2[0] >= 0){
if(x < k) cnt++;
else if(x == k) pq.push({cnt, str});
if(x >= k) chk = true;
cin >> str2;
if(!chk) x = stoi(str2);
}
}
else{
cin >> x;
while(x < k){
cnt++;
cin >> x;
}
if(x == k) pq.push({cnt, str});
int ss = min(3, (int)pq.size());
for(int i = 0; i < ss; i++){
cout << pq.top().second << " ";
pq.pop();
}
if(ss == 0) cout << -1;
}
}
}