よじろめ覚書

私の理解度重視のソースコードです。

ABC094B - Toll Gates

問題:B - Toll Gates

#include <algorithm>
#include <iostream>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)

int main(void) {
    int n, m, x, a, left = 0, right = 0;

    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> m >> x;
    REP(i, m) {
        cin >> a;
        if (a < x) {
            left++;
        } else {
            right++;
        }
    }
    
    cout << min(left, right) << "\n";
    return 0;
}