Submission

Status:

[P-SSS][-SSSS]

Subtask/Task Score:

{0/50}{0/50}

Score: 0

User: mzmvtbgf

Problemset: จุดแวะพัก

Language: cpp

Time: 0.005 second

Submitted On: 2026-03-11 11:42:18

#include <bits/stdc++.h>
using namespace std;
int a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;
vector<set<string>> vv;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n >> k;
    vv.resize(k);
    for (int i = 0 ; i < n ; i++)
    {
        string str;
        cin >> str;
        string ss;
        //cout << str << " ";
        getline(cin, ss);
        int now = 0;
        int ct = 0;
        for (char ch : ss)
        {
            if (ch == ' ')
            {
                if (now > k) break;
                else if (now == k) vv[ct].insert(str);
                else ct++;
                now = 0;
                continue;
            }
            else
            {
                now = 10*now + ch-'0';
            }
            //cout << now << " ";
        }
        if (now == k) vv[ct].insert(str);
        // cout << ct <<"\n";
    }
    int ct = 0;
    for (int i = 0 ; i < k ; i++)
    {
        for (string ss : vv[i])
        {
            cout << ss << " ";
            ct++;
        } 
        if (ct == 3) break;
    }
    return 0;
}