제출 #942639

#제출 시각아이디문제언어결과실행 시간메모리
942639CDuongNicelines (RMI20_nicelines)C++17
0 / 100
32 ms600 KiB
#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; } }

컴파일 시 표준 에러 (stderr) 메시지

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 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...