답안 #646996

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
646996 2022-10-01T10:10:32 Z danikoynov Nicelines (RMI20_nicelines) C++14
24 / 100
124 ms 312 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 = 10010;
const long double eps = 1e-9;
vector < long long > cur;
long long x;
bool process(long long lf, long long rf)
{
    if (rf - lf <= 1)
        return false;
    ///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);

    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;
    }

    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: In function 'void solve(int, int)':
nicelines.cpp:62:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   62 |     for (int i = 0; i < it1.size(); i ++)
      |                     ~~^~~~~~~~~~~~
nicelines.cpp:70:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   70 |     for (int i = 0; i < it1.size(); i ++)
      |                     ~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 208 KB Output is correct
2 Correct 5 ms 312 KB Output is correct
3 Correct 5 ms 300 KB Output is correct
4 Correct 6 ms 296 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 208 KB Output is correct
2 Correct 8 ms 208 KB Output is correct
3 Correct 7 ms 208 KB Output is correct
4 Correct 8 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 208 KB Output is correct
2 Incorrect 11 ms 208 KB Incorrect
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 124 ms 300 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 61 ms 208 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 124 ms 300 KB Incorrect
2 Halted 0 ms 0 KB -