#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; void pointsOnALine() { int n; cin >> n; int x0 = 0; int y0 = 0; int x1 = 0; int y1 = 0; bool isOnLine = true; for (int a0 = 0; a0 < n; a0++) { int x; int y; cin >> x >> y; // ax + by = c /* ax0 + by0 = c ax1 + by1 = c ax0y1 + by0y1 = cy1 ax1y0 + by1y0 = cy0 => a(x0y1 - x1y0) = c(y1 - y0) => a = c (y1 - y0) / (x0y1 - x1y0) ax0x1 + by0x1 = cx1 ax1x0 + by1x0 = cx0 => b(y0x1 - y1x0) = c(x1 - x0) => b = c (x1 - x0) / (y0x1 - y1x0) */ if (a0 == 0) { x0 = x; y0 = y; } else if (a0 == 1) { x1 = x; y1 = y; } else { if (y1 == y0) { if (y != y1) { isOnLine = false; break; } } else if (x1 == x0) { if (x != x1) { isOnLine = false; break; } } else { if ((y1 - y0) * (y0 * x1 - y1 * x0) * x + (x1 - x0) * (x0 * y1 - x1 * y0) * y != (x0 * y1 - x1 * y0) * (y0 * x1 - y1 * x0)) { isOnLine = false; break; } } } } if (isOnLine) { cout << "YES"; } else { cout << "NO"; } cout << endl; } int main(){ pointsOnALine(); return 0; }