Submission #1297673

#TimeUsernameProblemLanguageResultExecution timeMemory
1297673ThunnusNicelines (RMI20_nicelines)C++20
Compilation error
0 ms0 KiB
#include "nice_lines.h"
#include<bits/stdc++.h>
#pragma GCC optimize("unroll-loops,O3")
using namespace std;
using i64 = long long;
//#define int i64
#define vi vector<int>
#define vvi vector<vi>
#define vb vector<bool>
#define se second
#define fi first
#define pii pair<int, int>
#define sz(x) (int)(x).size()
#define double long double

const double INF = 2e12;

void solve(int sid, int n){
    i64 lo = -INF, hi = INF, m1, m2;
    int a = INF + 1, b = INF + 1;
    while(hi > lo){
        m1 = lo + (hi - lo) / 3;
        m2 = hi - (hi - lo) / 3;
        double q1 = query(0, m1), q2 = query(0, q2);
        if(q1 == q2){
            b = m1;
            break;
        }
        if(q1 > q2){
            lo = m1 + 1;
        }
        else{
            hi = m2 - 1;
        }
    }
    if(b > INF){
        for(int i = max(-INF, lo - 3); i <= min(INF, hi + 3); i++){
            if(query(0, i) == 0){
                b = i;
                break;
            }
        }
    }


    int y = 1;
    if(y == b) y++;
    lo = -INF, hi = INF;
    while(hi > lo){
        m1 = lo + (hi - lo) / 3;
        m2 = hi - (hi - lo) / 3;
        double q1 = query(m1, y), q2 = query(m2, y);
        if(q1 == q2){
            a = m1;
            break;
        }
        if(q1 > q2){
            lo = m1 + 1;
        }
        else{
            hi = m2 - 1;
        }
    }
    if(a > INF){
        for(int i = max(-INF, lo - 3); i <= min(INF, hi + 3); i++){
            if(query(i, y) == 0){
                a = i;
                break;
            }
        }
    }

    int slope = (a - b) / (y - 0);
    vi av, bv;
    av.emplace_back(slope), bv.emplace_back(b);
    the_lines_are(av, bv);
    return;
}

Compilation message (stderr)

nicelines.cpp: In function 'void solve(int, int)':
nicelines.cpp:20:17: warning: overflow in conversion from 'long double' to 'int' changes value from '2.000000000001e+12l' to '2147483647' [-Woverflow]
   20 |     int a = INF + 1, b = INF + 1;
      |             ~~~~^~~
nicelines.cpp:20:30: warning: overflow in conversion from 'long double' to 'int' changes value from '2.000000000001e+12l' to '2147483647' [-Woverflow]
   20 |     int a = INF + 1, b = INF + 1;
      |                          ~~~~^~~
nicelines.cpp:37:24: error: no matching function for call to 'max(long double, i64)'
   37 |         for(int i = max(-INF, lo - 3); i <= min(INF, hi + 3); i++){
      |                     ~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/13/vector:62,
                 from nice_lines.h:4,
                 from nicelines.cpp:1:
/usr/include/c++/13/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
nicelines.cpp:37:24: note:   deduced conflicting types for parameter 'const _Tp' ('long double' and 'i64' {aka 'long long int'})
   37 |         for(int i = max(-INF, lo - 3); i <= min(INF, hi + 3); i++){
      |                     ~~~^~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:303:5: note:   template argument deduction/substitution failed:
nicelines.cpp:37:24: note:   deduced conflicting types for parameter 'const _Tp' ('long double' and 'i64' {aka 'long long int'})
   37 |         for(int i = max(-INF, lo - 3); i <= min(INF, hi + 3); i++){
      |                     ~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/13/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
                 from nicelines.cpp:2:
/usr/include/c++/13/bits/stl_algo.h:5795:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5795 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5795:5: note:   template argument deduction/substitution failed:
nicelines.cpp:37:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'long double'
   37 |         for(int i = max(-INF, lo - 3); i <= min(INF, hi + 3); i++){
      |                     ~~~^~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:5805:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5805 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5805:5: note:   template argument deduction/substitution failed:
nicelines.cpp:37:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'long double'
   37 |         for(int i = max(-INF, lo - 3); i <= min(INF, hi + 3); i++){
      |                     ~~~^~~~~~~~~~~~~~
nicelines.cpp:37:48: error: no matching function for call to 'min(const long double&, i64)'
   37 |         for(int i = max(-INF, lo - 3); i <= min(INF, hi + 3); i++){
      |                                             ~~~^~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
nicelines.cpp:37:48: note:   deduced conflicting types for parameter 'const _Tp' ('long double' and 'i64' {aka 'long long int'})
   37 |         for(int i = max(-INF, lo - 3); i <= min(INF, hi + 3); i++){
      |                                             ~~~^~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:281:5: note:   template argument deduction/substitution failed:
nicelines.cpp:37:48: note:   deduced conflicting types for parameter 'const _Tp' ('long double' and 'i64' {aka 'long long int'})
   37 |         for(int i = max(-INF, lo - 3); i <= min(INF, hi + 3); i++){
      |                                             ~~~^~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:5775:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5775 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5775:5: note:   template argument deduction/substitution failed:
nicelines.cpp:37:48: note:   mismatched types 'std::initializer_list<_Tp>' and 'long double'
   37 |         for(int i = max(-INF, lo - 3); i <= min(INF, hi + 3); i++){
      |                                             ~~~^~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:5785:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5785 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5785:5: note:   template argument deduction/substitution failed:
nicelines.cpp:37:48: note:   mismatched types 'std::initializer_list<_Tp>' and 'long double'
   37 |         for(int i = max(-INF, lo - 3); i <= min(INF, hi + 3); i++){
      |                                             ~~~^~~~~~~~~~~~~
nicelines.cpp:65:24: error: no matching function for call to 'max(long double, i64)'
   65 |         for(int i = max(-INF, lo - 3); i <= min(INF, hi + 3); i++){
      |                     ~~~^~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
nicelines.cpp:65:24: note:   deduced conflicting types for parameter 'const _Tp' ('long double' and 'i64' {aka 'long long int'})
   65 |         for(int i = max(-INF, lo - 3); i <= min(INF, hi + 3); i++){
      |                     ~~~^~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:303:5: note:   template argument deduction/substitution failed:
nicelines.cpp:65:24: note:   deduced conflicting types for parameter 'const _Tp' ('long double' and 'i64' {aka 'long long int'})
   65 |         for(int i = max(-INF, lo - 3); i <= min(INF, hi + 3); i++){
      |                     ~~~^~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:5795:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5795 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5795:5: note:   template argument deduction/substitution failed:
nicelines.cpp:65:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'long double'
   65 |         for(int i = max(-INF, lo - 3); i <= min(INF, hi + 3); i++){
      |                     ~~~^~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:5805:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5805 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5805:5: note:   template argument deduction/substitution failed:
nicelines.cpp:65:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'long double'
   65 |         for(int i = max(-INF, lo - 3); i <= min(INF, hi + 3); i++){
      |                     ~~~^~~~~~~~~~~~~~
nicelines.cpp:65:48: error: no matching function for call to 'min(const long double&, i64)'
   65 |         for(int i = max(-INF, lo - 3); i <= min(INF, hi + 3); i++){
      |                                             ~~~^~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
nicelines.cpp:65:48: note:   deduced conflicting types for parameter 'const _Tp' ('long double' and 'i64' {aka 'long long int'})
   65 |         for(int i = max(-INF, lo - 3); i <= min(INF, hi + 3); i++){
      |                                             ~~~^~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:281:5: note:   template argument deduction/substitution failed:
nicelines.cpp:65:48: note:   deduced conflicting types for parameter 'const _Tp' ('long double' and 'i64' {aka 'long long int'})
   65 |         for(int i = max(-INF, lo - 3); i <= min(INF, hi + 3); i++){
      |                                             ~~~^~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:5775:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5775 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5775:5: note:   template argument deduction/substitution failed:
nicelines.cpp:65:48: note:   mismatched types 'std::initializer_list<_Tp>' and 'long double'
   65 |         for(int i = max(-INF, lo - 3); i <= min(INF, hi + 3); i++){
      |                                             ~~~^~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:5785:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5785 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5785:5: note:   template argument deduction/substitution failed:
nicelines.cpp:65:48: note:   mismatched types 'std::initializer_list<_Tp>' and 'long double'
   65 |         for(int i = max(-INF, lo - 3); i <= min(INF, hi + 3); i++){
      |                                             ~~~^~~~~~~~~~~~~