Submission #647010

# Submission time Handle Problem Language Result Execution time Memory
647010 2022-10-01T11:09:42 Z danikoynov Nicelines (RMI20_nicelines) C++14
Compilation error
0 ms 0 KB
using namespace std;

int maxcor = 2e4 + 10;
const long double eps = 1e-9;
vector < long long > cur;
long long x;

bool process(long long lf, long long rf, long double d1, long double d2)
{
    if (rf - lf <= 1)
        return false;


    ///cout << lf << " :: " << rf << endl;
    long long mid = (lf + rf) / 2;
    long double md = query(x, mid);

    long double sum = (long double)(rf - lf) / (long double)(mid - lf) * (md - d1);
     ///cout << lf << " " << rf << " " << mid << " " << d1 << " " << md << " " << d2 << " " << sum << endl;
    if (abs(sum - (d2 - d1)) < eps)
    {
        ///cout << "here" << endl;
        return false;
    }

    bool tf1 = process(lf, (mid), d1, md);
    bool tf2 = process((mid), rf, md, d2);

    /**if (rf - lf < 100)
    {
        if (!tf1 && !tf2)
            cur.push_back((round)(mid));
    }
    else*/
    if ((query(x, mid - 1) - md) - (md - query(x, mid + 1)) > eps)
        cur.push_back((round)(mid));


    return max(tf1, tf2);
}

void solve(int subtask_id, int N)
{

    ///cout << (ceil)(2.0) << endl;
    cur.clear();
    x = maxcor * 2;
    long long lf = -maxcor * maxcor, rf = maxcor * maxcor;
    process(lf, rf, query(x, lf), query(x, rf));
    vector < long long > it1 = cur;

    cur.clear();
    x = maxcor * 2 + 1;
        process(lf, rf, query(x, lf), query(x, rf));
    vector < long long > it2 = cur;

    sort(it1.begin(), it1.end());
    sort(it2.begin(), it2.end());

    ///cout << it1.size() << " " << it2.size() << endl;
    vector < int > a, b;
    for (int i = 0; i < it1.size(); i ++)
    {
        ///cout << it1[i] << " " << it2[i] << endl;
        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

nicelines.cpp:5:1: error: 'vector' does not name a type
    5 | vector < long long > cur;
      | ^~~~~~
nicelines.cpp: In function 'bool process(long long int, long long int, long double, long double)':
nicelines.cpp:16:22: error: 'query' was not declared in this scope
   16 |     long double md = query(x, mid);
      |                      ^~~~~
nicelines.cpp:20:9: error: 'abs' was not declared in this scope
   20 |     if (abs(sum - (d2 - d1)) < eps)
      |         ^~~
nicelines.cpp:36:9: error: 'cur' was not declared in this scope
   36 |         cur.push_back((round)(mid));
      |         ^~~
nicelines.cpp:36:24: error: 'round' was not declared in this scope
   36 |         cur.push_back((round)(mid));
      |                        ^~~~~
nicelines.cpp:39:12: error: 'max' was not declared in this scope
   39 |     return max(tf1, tf2);
      |            ^~~
nicelines.cpp: In function 'void solve(int, int)':
nicelines.cpp:46:5: error: 'cur' was not declared in this scope
   46 |     cur.clear();
      |     ^~~
nicelines.cpp:49:21: error: 'query' was not declared in this scope
   49 |     process(lf, rf, query(x, lf), query(x, rf));
      |                     ^~~~~
nicelines.cpp:50:5: error: 'vector' was not declared in this scope
   50 |     vector < long long > it1 = cur;
      |     ^~~~~~
nicelines.cpp:1:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
  +++ |+#include <vector>
    1 | using namespace std;
nicelines.cpp:50:14: error: expected primary-expression before 'long'
   50 |     vector < long long > it1 = cur;
      |              ^~~~
nicelines.cpp:55:14: error: expected primary-expression before 'long'
   55 |     vector < long long > it2 = cur;
      |              ^~~~
nicelines.cpp:57:10: error: 'it1' was not declared in this scope
   57 |     sort(it1.begin(), it1.end());
      |          ^~~
nicelines.cpp:57:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   57 |     sort(it1.begin(), it1.end());
      |     ^~~~
      |     short
nicelines.cpp:58:10: error: 'it2' was not declared in this scope
   58 |     sort(it2.begin(), it2.end());
      |          ^~~
nicelines.cpp:61:14: error: expected primary-expression before 'int'
   61 |     vector < int > a, b;
      |              ^~~
nicelines.cpp:65:9: error: 'a' was not declared in this scope
   65 |         a.push_back((round)(it2[i] - it1[i]));
      |         ^
nicelines.cpp:65:22: error: 'round' was not declared in this scope
   65 |         a.push_back((round)(it2[i] - it1[i]));
      |                      ^~~~~
nicelines.cpp:66:9: error: 'b' was not declared in this scope
   66 |         b.push_back((round)(it2[i] - x * (it2[i] - it1[i])));
      |         ^
nicelines.cpp:69:19: error: 'a' was not declared in this scope
   69 |     the_lines_are(a, b);
      |                   ^
nicelines.cpp:69:22: error: 'b' was not declared in this scope
   69 |     the_lines_are(a, b);
      |                      ^
nicelines.cpp:69:5: error: 'the_lines_are' was not declared in this scope
   69 |     the_lines_are(a, b);
      |     ^~~~~~~~~~~~~