You are viewing a single comment's thread. Return to all comments →
int main() { int n; int xfirst; int yfirst; bool h = true; bool v = true;
cin >> n; vector<pair<int,int>> points(n); cin.ignore(numeric_limits<streamsize>::max(), '\n'); for (int n_itr = 0; n_itr < n; n_itr++) { string xy_temp; getline(cin, xy_temp); vector<string> xy = split_string(xy_temp); int x = stoi(xy[0]); int y = stoi(xy[1]); points[n_itr] = {x,y}; xfirst = points[0].first; } for (int i = 0; i < n;i++) { if (points[i].first != xfirst) { h = false; break; } } yfirst = points[0].second; for (int j = 0; j < n;j++) { if (points[j].second != yfirst) { dprintf(2,"%d <------ -------> %d\n",points[j].second,yfirst); v = false; break; } } if (h || v) cout << "YES"; else cout << "NO"; return 0;
}
Seems like cookies are disabled on this browser, please enable them to open this website
Points On a Line
You are viewing a single comment's thread. Return to all comments →
int main() { int n; int xfirst; int yfirst; bool h = true; bool v = true;
}