Submission #647043

#TimeUsernameProblemLanguageResultExecution timeMemory
647043danikoynovNicelines (RMI20_nicelines)C++14
11 / 100
1 ms304 KiB
/** ____ ____ ____ ____ ____ ____ ||l |||e |||i |||n |||a |||d || ||__|||__|||__|||__|||__|||__|| |/__\|/__\|/__\|/__\|/__\|/__\| **/ #include<bits/stdc++.h> #define endl '\n' #include "nice_lines.h" using namespace std; const int V = 1e4 + 10; const long double eps = 1e-9; struct point { long double x, y; point(long double _x = 0, long double _y = 0) { x = _x; y = _y; } }; struct line { point A, B; long double k, m; line(point _A, point _B) { A = _A; B = _B; k = (B.y - A.y) / (B.x - A.x); /// k * A.x + m = A.y m = A.y - A.x * k; } }; point intersection(line l1, line l2) { long double x = (l2.m - l1.m) / (l1.k - l2.k), y = l1.k * x + l1.m; return point(x, y); } void solve(int subtask_id, int N) { point A1(3 * V * V, query(3 * V, 3 * V * V)), B1(3 * V * V + 1, query(3 * V, 3 * V * V + 1)); line l1(A1, B1); point A2(- 3 * V * V, query(3 * V, - 3 * V * V)), B2(- 3 * V * V + 1, query(3 * V, - 3 * V * V + 1)); line l2(A2, B2); point p = intersection(l1, l2); vector < int > a, b; int d = round(p.x); for (int pa = -V; pa < V; pa ++) { int lf = d - pa * 3 * V; if (lf > - V && lf < V) { a.push_back(pa); b.push_back(lf); break; } } the_lines_are(a, b); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...