#38056: 可以幫幫我為甚麼40%嗎?


wheat20131@gmail.com (後為什麼又TLE啦:()

學校 : 高雄市立三民高級中學
編號 : 218090
來源 : [61.227.12.205]
最後登入時間 :
2025-04-09 18:42:37

#include <bits/stdc++.h>
using namespace std;
int main(){
    int a,b;
    cin >> a >> b;
    int c[b];
    for(int i = 0; i < b;i++){
        cin >> c[i];
    }
    vector <int>l,s;
    for(int i = 0; i < b;i++){
        if(c[i] > a){
            l.push_back(c[i]);
        }
        else if(c[i] < a){
            s.push_back(c[i]);
        }
       
    }
    sort(l.begin(),l.end());
    sort(s.begin(),s.end());
    if(l.size()> s.size()){
        cout << l.size() << " " << l[l.size()] << endl;
    }
    else if(l.size()< s.size()){
        cout << s.size() << " " <<s[0] << endl;
    }

    return 0;
}
#38061: Re: 可以幫幫我為甚麼40%嗎?


liaoweichen1024@gmail.com (M_SQRT)

學校 : 新北市立新莊高級中學
編號 : 195452
來源 : [140.114.123.98]
最後登入時間 :
2025-09-24 19:10:46

    if(l.size()> s.size()){
        cout << l.size() << " " << l[l.size()] << endl;
    }


l[l.size()-1]

#38062: Re: 可以幫幫我為甚麼40%嗎?


asnewchien@gmail.com (david)

學校 : 南投縣立旭光高級中學
編號 : 68108
來源 : [114.42.176.221]
最後登入時間 :
2025-10-04 22:52:03

if(c[i] >= a){
            l.push_back(c[i]);
        }
  if(c[i] < =a){
            s.push_back(c[i]);
        }