Submission #942639

# Submission time Handle Problem Language Result Execution time Memory
942639 2024-03-11T02:20:00 Z CDuong Nicelines (RMI20_nicelines) C++17
0 / 100
32 ms 600 KB
#include "nice_lines.h"
#include <bits/stdc++.h>
#define taskname ""
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define i64 long long
#define pb push_back
#define ff first
#define ss second
#define isz(x) (int)x.size()
using namespace std;

const int mxN = 2e5 + 5;
const int mod = 1e9 + 7;
const long double eps = 1e-8;
const i64 oo = 1e18;

void solve1() {
    long double xl = -1e12, xr = 1e12;
    for (int i = 1; i <= 1000; ++i) {
        long double midl = xl + (xr - xl) / 3;
        long double midr = xr - (xr - xl) / 3;
        // cout << midl << " " << midr << endl;
        // cout << query(midl, 0) << " " << query(midr, 0) << endl;
        if (query(midl, 0) >= query(midr, 0)) xl = midl;
        else xr = midr;
    }
    auto x0 = xl;
    xl = -1e12, xr = 1e12;
    for (int i = 1; i <= 1000; ++i) {
        long double midl = xl + (xr - xl) / 3;
        long double midr = xr - (xr - xl) / 3;
        if (query(midl, 1) >= query(midr, 1)) xl = midl;
        else xr = midr;
    }
    auto x1 = xl;
    // cout << x0 << " " << x1 << endl;
    auto slope = 1.0L / (x1 - x0);
    auto other = -x0 * slope;
    the_lines_are({round(slope)}, {round(other)});
}

void solve(int subtask_id, int N) {
    if (subtask_id == 1) {
        solve1();
        return;
    }
}

Compilation message

nicelines.cpp: In function 'void solve1()':
nicelines.cpp:40:25: warning: narrowing conversion of 'std::round(slope)' from 'long double' to 'int' [-Wnarrowing]
   40 |     the_lines_are({round(slope)}, {round(other)});
      |                    ~~~~~^~~~~~~
nicelines.cpp:40:25: warning: narrowing conversion of 'std::round(slope)' from 'long double' to 'int' [-Wnarrowing]
nicelines.cpp:40:41: warning: narrowing conversion of 'std::round(other)' from 'long double' to 'int' [-Wnarrowing]
   40 |     the_lines_are({round(slope)}, {round(other)});
      |                                    ~~~~~^~~~~~~
nicelines.cpp:40:41: warning: narrowing conversion of 'std::round(other)' from 'long double' to 'int' [-Wnarrowing]
# Verdict Execution time Memory Grader output
1 Incorrect 32 ms 600 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 596 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -