結果
| 問題 |
No.550 夏休みの思い出(1)
|
| コンテスト | |
| ユーザー |
ei1333333
|
| 提出日時 | 2017-07-28 23:17:02 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 790 bytes |
| コンパイル時間 | 1,548 ms |
| コンパイル使用メモリ | 174,096 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-10 04:53:28 |
| 合計ジャッジ時間 | 30,886 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 WA * 35 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:37:8: warning: use of an operand of type 'bool' in 'operator++' is deprecated [-Wdeprecated]
37 | if(first++) cout << " ";
| ^~~~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long int64;
int main()
{
int64 A, B, C;
cin >> A >> B >> C;
auto f = [&](auto x)
{
return (x * x * x + A * x * x + B * x + C);
};
set< int64 > vs;
double shift = 1e5;
double shift2 = 1e4;
for(double low = -1000000001; low <= 1000000001; low += shift) {
double high = low + shift;
for(int i = 0; i < 100; i++) {
double left = (low * 2 + high) / 3;
double right = (low + high * 2) / 3;
if(abs(f(left)) < abs(f(right))) high = right;
else low = left;
}
for(int64 j = low - shift2; j <= low + shift2; j++) {
if(f(j) == 0) vs.emplace(j);
}
}
bool first = false;
for(auto &s : vs) {
if(first++) cout << " ";
cout << s;
}
cout << endl;
}
ei1333333