Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<vector>
- #include<algorithm>
- using namespace std;
- int n, sx, sy;
- int main(){
- cin >> n >> sx >> sy;
- vector<int> l(5, 0); l[0] = -1;
- for (int i = 0; i < n; ++i){
- int x; int y;
- cin >> x; cin >> y;
- if ((x > sx) && (y > sy)){
- l[1]++;
- l[2]++;
- }
- if ((x < sx) && (y > sy)){
- l[1]++;
- l[4]++;
- }
- if ((x < sx) && (y < sy)){
- l[4]++;
- l[3]++;
- }
- if ((x > sx) && (y < sy)){
- l[2]++;
- l[3]++;
- }
- if ((x == sx) && (y > sy)) l[1]++;
- if ((y < sy) && (x == sx)) l[3]++;
- if ((x > sx) && (y == sy)) l[2]++;
- if ((x < sx) && (y == sy)) l[4]++;
- }
- int pos; int m = -1;
- for (int i = 1; i < 5; ++i){
- if (l[i] >= m){
- m = l[i];
- pos = i;
- }
- }
- cout << m << endl;
- if (pos == 1)
- cout << sx << " " << sy + 1;
- else if (pos == 2)
- cout << sx + 1 << " " << sy;
- else if (pos == 3)
- cout << sx << " " << sy - 1;
- else if (pos == 4)
- cout << sx - 1 << " " << sy;
- }
Advertisement
Add Comment
Please, Sign In to add comment