Submission #647005

#TimeUsernameProblemLanguageResultExecution timeMemory
647005danikoynovNicelines (RMI20_nicelines)C++14
0 / 100
61 ms288 KiB
/** ____ ____ ____ ____ ____ ____ ||l |||e |||i |||n |||a |||d || ||__|||__|||__|||__|||__|||__|| |/__\|/__\|/__\|/__\|/__\|/__\| **/ #include<bits/stdc++.h> #define endl '\n' #include "nice_lines.h" using namespace std; using namespace std; typedef long long ll; int maxcor = 1e4; const long double eps = 1e-9; vector < long long > cur; long long x; int _N; void intersection_points() { long long base = -maxcor * maxcor; while(cur.size() < _N) { ll lf = base, rf = maxcor * maxcor; long double db = query(x, base); while(rf - lf > 1) { ll mf = (lf + rf) / 2; long double md = query(x, mf); long double am = (long double)(base + mf) / 2.0; long double df = query(x, am); ///cout << lf << " " << rf << " " << endl; if (abs((df - db) - (md - df)) < eps) lf = mf; else rf = mf - 1; } cur.push_back(lf); base = lf + 1; } } void solve(int subtask_id, int N) { _N = N; if (N > 3) maxcor = 510; ///cout << (ceil)(2.0) << endl; cur.clear(); x = maxcor * 2; long long lf = -maxcor * maxcor, rf = maxcor * maxcor; intersection_points(); vector < long long > it1 = cur; cur.clear(); x = maxcor * 2 + 1; intersection_points(); vector < long long > it2 = cur; sort(it1.begin(), it1.end()); sort(it2.begin(), it2.end()); vector < int > a, b; for (int i = 0; i < it1.size(); i ++) { a.push_back((round)(it2[i] - it1[i])); b.push_back((round)(it2[i] - x * (it2[i] - it1[i]))); } the_lines_are(a, b); }

Compilation message (stderr)

nicelines.cpp: In function 'void intersection_points()':
nicelines.cpp:26:22: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   26 |     while(cur.size() < _N)
      |           ~~~~~~~~~~~^~~~
nicelines.cpp: In function 'void solve(int, int)':
nicelines.cpp:69:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   69 |     for (int i = 0; i < it1.size(); i ++)
      |                     ~~^~~~~~~~~~~~
nicelines.cpp:56:15: warning: unused variable 'lf' [-Wunused-variable]
   56 |     long long lf = -maxcor * maxcor, rf = maxcor * maxcor;
      |               ^~
nicelines.cpp:56:38: warning: unused variable 'rf' [-Wunused-variable]
   56 |     long long lf = -maxcor * maxcor, rf = maxcor * maxcor;
      |                                      ^~
#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...