Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <vector>
- #include <cmath>
- #include <ctime>
- #include <sstream>
- #include <algorithm>
- #include <set>
- #include <map>
- #include <unordered_map>
- #include <unordered_set>
- using namespace std;
- struct Point {
- int x, y;
- };
- int main()
- {
- ifstream fin;
- fin.open("input.txt");
- size_t N;
- fin >> N;
- vector<Point> points(N);
- for (size_t i = 0; i < N; i++)
- fin >> points[i].x >> points[i].y;
- fin.close();
- bool IsOneLine = true;
- for (size_t i = 2; i < N; ++i)
- if (0.5 * ((points[i - 2].x - points[i].x) * (points[i - 1].y - points[i].y) -
- (points[i - 1].x - points[i].x) * (points[i - 2].y - points[i].y)) != 0) {
- IsOneLine = false;
- break;
- }
- fstream fout;
- fout.open("output.txt", ios::out);
- if (IsOneLine)
- fout << "yes";
- else
- fout << "no";
- fout.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement