#38063: _C++


qqazwwsxeedcrrfvttgb@gmail.com (Jackis666)

學校 : 嘉義市私立輔仁高級中學
編號 : 226198
來源 : [39.9.66.12]
最後登入時間 :
2025-08-08 13:23:15

include "bits/stdc++.h"

using namespace std;

int main(){

    int x,n;

    while(cin>>x>>n){

        int ptr[n];

        for(int i=0;i<n;i++)

            cin>>ptr[i];

        sort(ptr,ptr+n);

        int low=0,high=0;

        for(int i=0;i<n;i++){

            if(ptr[i]<x)

                low++;

            else

                high++;

        }

        if(low>high){

            cout<<low<<" "<<ptr[0];

        }

        else

            cout<<high<<" "<<ptr[n-1];

    }

}