Submission #646985

# Submission time Handle Problem Language Result Execution time Memory
646985 2022-10-01T09:54:10 Z danikoynov Nicelines (RMI20_nicelines) C++14
0 / 100
130 ms 292 KB
/**
 ____ ____ ____ ____ ____ ____
||l |||e |||i |||n |||a |||d ||
||__|||__|||__|||__|||__|||__||
|/__\|/__\|/__\|/__\|/__\|/__\|

**/

#include<bits/stdc++.h>
#define endl '\n'
#include "nice_lines.h"
using namespace std;
typedef long long ll;

const int maxcor = 1e4 + 10;
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 double mid = (long double)(lf + rf) / 2.0;
    long double md = query(x, mid);
    ///cout << lf << " " << rf << " " << mid << " " << d1 << " " << md << " " << d2 << endl;
    if (abs((md - d1) - (d2 - md)) < 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(mid);
    }
    else
    {
        bool tf1 = process(lf, (ceil)(mid));
        bool tf2 = process((floor)(mid), rf);
        if (!tf1 && !tf2)
            cur.push_back(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 ++)
    {
        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 solve(int, int)':
nicelines.cpp:58:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   58 |     for (int i = 0; i < it1.size(); i ++)
      |                     ~~^~~~~~~~~~~~
nicelines.cpp:66:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   66 |     for (int i = 0; i < it1.size(); i ++)
      |                     ~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 6 ms 208 KB Output is correct
2 Incorrect 6 ms 208 KB Incorrect
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 130 ms 292 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 54 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 130 ms 292 KB Incorrect
2 Halted 0 ms 0 KB -