Submission #875251

#TimeUsernameProblemLanguageResultExecution timeMemory
875251Ahmed57Nicelines (RMI20_nicelines)C++17
11 / 100
39 ms600 KiB
#include <bits/stdc++.h>
#include "nice_lines.h"
using namespace std;

void solve(int subtaskid,int N){
    double l = -1000000000.0 , r = 1000000000.0;
    for(int x = 0;x<1000;x++){
        double f1 = l+(r-l)/3 , f2 = r-(r-l)/3;
        if(query(0,f1)<=query(0,f2)){
            r = f2;
        }else l = f1;
    }
    double y1 = l;
    l = -1000000000.0 , r = 1000000000.0;
    for(int x = 0;x<1000;x++){
        double f1 = l+(r-l)/3.0 , f2 = r-(r-l)/3.0;
        if(query(1,f1)<=query(1,f2)){
            r = f2;
        }else l = f1;
    }
    double y2 = l;
    double m = (y2-y1);
    the_lines_are({round(m)},{round(y1)});
}

Compilation message (stderr)

nicelines.cpp: In function 'void solve(int, int)':
nicelines.cpp:23:25: warning: narrowing conversion of 'round(m)' from 'double' to 'int' [-Wnarrowing]
   23 |     the_lines_are({round(m)},{round(y1)});
      |                    ~~~~~^~~
nicelines.cpp:23:25: warning: narrowing conversion of 'round(m)' from 'double' to 'int' [-Wnarrowing]
nicelines.cpp:23:36: warning: narrowing conversion of 'round(y1)' from 'double' to 'int' [-Wnarrowing]
   23 |     the_lines_are({round(m)},{round(y1)});
      |                               ~~~~~^~~~
nicelines.cpp:23:36: warning: narrowing conversion of 'round(y1)' from 'double' to 'int' [-Wnarrowing]
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...