题解 # 很明显帐篷应该和学校挨着,所以我们可以用四个变量来记录学校的每一边有几个房子,最后输出最多的那一边即可。 Code # #include <bits/stdc++.h> #define forn(i, n) for (int i = 0; i < (int)(n); ++i) #define for1(i, n) for (int i = 1; i <= (int)(n); ++i) #define fore(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i) #define ford(i, n) for (int i = (int)(n)-1; i >= 0; --i) #define pb push_back #define ms(a, x) memset(a, x, sizeof(a)) #define F first #define S second #define endl '\n' using namespace std; const int INF = 0x3f3f3f3f; typedef long long ll; typedef pair<int, int> pii; int main() { ios::sync_with_stdio(false); cin.tie(0); int n,x,y; cin>>n>>x>>y; int a=0,b=0,c=0,d=0; forn(i,n){ int k,j; cin>>j>>k; if(j>x) a++; else if(j<x) b++; if(k>y) c++; else if(k<y) d++; } int mx=max({a,b,d,c}); cout<<mx<<endl; if(mx==a) cout<<x+1<<' '<<y; else if(mx==b) cout<<x-1<<' '<<y; else if(mx==c) cout<<x<<' '<<y+1; else cout<<x<<' '<<y-1; return 0; }