Submission #647005

# Submission time Handle Problem Language Result Execution time Memory
647005 2022-10-01T11:02:51 Z danikoynov Nicelines (RMI20_nicelines) C++14
0 / 100
61 ms 288 KB
/**
 ____ ____ ____ ____ ____ ____
||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

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 time Memory Grader output
1 Correct 2 ms 208 KB Output is correct
2 Incorrect 2 ms 208 KB Incorrect
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 61 ms 288 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 61 ms 288 KB Incorrect
2 Halted 0 ms 0 KB -