Submission #646993

# Submission time Handle Problem Language Result Execution time Memory
646993 2022-10-01T10:07:41 Z danikoynov Nicelines (RMI20_nicelines) C++14
Compilation error
0 ms 0 KB
const int maxcor = 10010;
const long double eps = 1e-9;
vector < long long > cur;
long long x;
bool process(long long lf, long long rf)
{
    ///cout << lf << " :: " << rf << endl;
    long double d1 = query(x, lf), d2 = query(x, rf);
    long long mid = (lf + rf) / 2;
    long double md = query(x, mid);
    ///cout << lf << " " << rf << " " << mid << " " << d1 << " " << md << " " << d2 << endl;
    long double sum = (long double)(rf - lf) / (long double)(mid - lf) * (md - d1);
    if (abs(sum - (d2 - d1)) < eps)
    {
        ///cout << "here" << endl;
        return false;
    }

    if (mid > 0)
    {
        bool tf1 = process(lf, (floor)(mid));
        bool tf2 = process((ceil)(mid), rf);
        if (!tf1 && !tf2)
            cur.push_back((round)(mid));
    }
    else
    {
        bool tf1 = process(lf, (ceil)(mid));
        bool tf2 = process((floor)(mid), rf);
        if (!tf1 && !tf2)
            cur.push_back((round)(mid));
    }
    return true;

}

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);
    vector < long long > it1 = cur;
    for (int i = 0; i < it1.size(); i ++)
        cout << it1[i] << endl;
    cur.clear();
    x = maxcor * 2 + 1;
        process(lf, rf);
    vector < long long > it2 = cur;

    vector < int > a, b;
    for (int i = 0; i < it1.size(); i ++)
    {
        ///cout << it2[i] << " " << it1[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:3:1: error: 'vector' does not name a type
    3 | vector < long long > cur;
      | ^~~~~~
nicelines.cpp: In function 'bool process(long long int, long long int)':
nicelines.cpp:8:22: error: 'query' was not declared in this scope
    8 |     long double d1 = query(x, lf), d2 = query(x, rf);
      |                      ^~~~~
nicelines.cpp:13:20: error: 'd2' was not declared in this scope; did you mean 'd1'?
   13 |     if (abs(sum - (d2 - d1)) < eps)
      |                    ^~
      |                    d1
nicelines.cpp:13:9: error: 'abs' was not declared in this scope
   13 |     if (abs(sum - (d2 - d1)) < eps)
      |         ^~~
nicelines.cpp:21:33: error: 'floor' was not declared in this scope
   21 |         bool tf1 = process(lf, (floor)(mid));
      |                                 ^~~~~
nicelines.cpp:22:29: error: 'ceil' was not declared in this scope
   22 |         bool tf2 = process((ceil)(mid), rf);
      |                             ^~~~
nicelines.cpp:24:13: error: 'cur' was not declared in this scope
   24 |             cur.push_back((round)(mid));
      |             ^~~
nicelines.cpp:24:28: error: 'round' was not declared in this scope
   24 |             cur.push_back((round)(mid));
      |                            ^~~~~
nicelines.cpp:28:33: error: 'ceil' was not declared in this scope
   28 |         bool tf1 = process(lf, (ceil)(mid));
      |                                 ^~~~
nicelines.cpp:29:29: error: 'floor' was not declared in this scope
   29 |         bool tf2 = process((floor)(mid), rf);
      |                             ^~~~~
nicelines.cpp:31:13: error: 'cur' was not declared in this scope
   31 |             cur.push_back((round)(mid));
      |             ^~~
nicelines.cpp:31:28: error: 'round' was not declared in this scope
   31 |             cur.push_back((round)(mid));
      |                            ^~~~~
nicelines.cpp: In function 'void solve(int, int)':
nicelines.cpp:40:5: error: 'cur' was not declared in this scope
   40 |     cur.clear();
      |     ^~~
nicelines.cpp:44:5: error: 'vector' was not declared in this scope
   44 |     vector < long long > it1 = cur;
      |     ^~~~~~
nicelines.cpp:44:14: error: expected primary-expression before 'long'
   44 |     vector < long long > it1 = cur;
      |              ^~~~
nicelines.cpp:45:25: error: 'it1' was not declared in this scope
   45 |     for (int i = 0; i < it1.size(); i ++)
      |                         ^~~
nicelines.cpp:46:9: error: 'cout' was not declared in this scope
   46 |         cout << it1[i] << endl;
      |         ^~~~
nicelines.cpp:46:27: error: 'endl' was not declared in this scope
   46 |         cout << it1[i] << endl;
      |                           ^~~~
nicelines.cpp:50:14: error: expected primary-expression before 'long'
   50 |     vector < long long > it2 = cur;
      |              ^~~~
nicelines.cpp:52:14: error: expected primary-expression before 'int'
   52 |     vector < int > a, b;
      |              ^~~
nicelines.cpp:53:25: error: 'it1' was not declared in this scope
   53 |     for (int i = 0; i < it1.size(); i ++)
      |                         ^~~
nicelines.cpp:56:9: error: 'a' was not declared in this scope
   56 |         a.push_back((round)(it2[i] - it1[i]));
      |         ^
nicelines.cpp:56:22: error: 'round' was not declared in this scope
   56 |         a.push_back((round)(it2[i] - it1[i]));
      |                      ^~~~~
nicelines.cpp:56:29: error: 'it2' was not declared in this scope
   56 |         a.push_back((round)(it2[i] - it1[i]));
      |                             ^~~
nicelines.cpp:57:9: error: 'b' was not declared in this scope
   57 |         b.push_back((round)(it2[i] - x * (it2[i] - it1[i])));
      |         ^
nicelines.cpp:60:19: error: 'a' was not declared in this scope
   60 |     the_lines_are(a, b);
      |                   ^
nicelines.cpp:60:22: error: 'b' was not declared in this scope
   60 |     the_lines_are(a, b);
      |                      ^
nicelines.cpp:60:5: error: 'the_lines_are' was not declared in this scope
   60 |     the_lines_are(a, b);
      |     ^~~~~~~~~~~~~