#46521: c++ans


yp11151230@yphs.tp.edu.tw (909-42蔡亞儒)

學校 : 臺北市私立延平高級中學
編號 : 197211
來源 : [150.129.72.232]
最後登入時間 :
2025-07-09 18:05:16

#include <bits/stdc++.h>

using namespace std;

int main() {
    int x,n;
    cin>>x>>n;
    
    int cntL=0;
    int cntR=0;
    int posL=100;
    int posR=-100;
    while(n--){
        int food;
        cin>>food;
        if(food<x){
            cntL++;
        }
        else{
            cntR++;
        }
        posL=min(posL,food);
        posR=max(posR,food);
    }
    if(cntR>cntL){
    cout<<cntR<<" " <<posR ;
    }
    else{
        cout<<cntL<<" " <<posL ;
    }
}