結果

問題 No.955 ax^2+bx+c=0
ユーザー mfbgjsczmfbgjscz
提出日時 2020-05-26 03:34:05
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,038 bytes
コンパイル時間 1,796 ms
コンパイル使用メモリ 170,496 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-21 04:04:04
合計ジャッジ時間 8,024 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
5,248 KB
testcase_01 WA -
testcase_02 AC 30 ms
5,376 KB
testcase_03 WA -
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 0 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 1 ms
5,376 KB
testcase_16 AC 1 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 1 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 32 ms
5,376 KB
testcase_35 AC 33 ms
5,376 KB
testcase_36 AC 33 ms
5,376 KB
testcase_37 AC 32 ms
5,376 KB
testcase_38 AC 32 ms
5,376 KB
testcase_39 AC 30 ms
5,376 KB
testcase_40 AC 31 ms
5,376 KB
testcase_41 AC 32 ms
5,376 KB
testcase_42 AC 32 ms
5,376 KB
testcase_43 AC 32 ms
5,376 KB
testcase_44 AC 32 ms
5,376 KB
testcase_45 AC 31 ms
5,376 KB
testcase_46 AC 32 ms
5,376 KB
testcase_47 AC 31 ms
5,376 KB
testcase_48 AC 32 ms
5,376 KB
testcase_49 AC 32 ms
5,376 KB
testcase_50 AC 32 ms
5,376 KB
testcase_51 AC 32 ms
5,376 KB
testcase_52 AC 32 ms
5,376 KB
testcase_53 AC 33 ms
5,376 KB
testcase_54 AC 31 ms
5,376 KB
testcase_55 AC 33 ms
5,376 KB
testcase_56 AC 32 ms
5,376 KB
testcase_57 AC 34 ms
5,376 KB
testcase_58 AC 33 ms
5,376 KB
testcase_59 AC 31 ms
5,376 KB
testcase_60 AC 33 ms
5,376 KB
testcase_61 AC 30 ms
5,376 KB
testcase_62 AC 31 ms
5,376 KB
testcase_63 AC 31 ms
5,376 KB
testcase_64 AC 33 ms
5,376 KB
testcase_65 AC 33 ms
5,376 KB
testcase_66 AC 33 ms
5,376 KB
testcase_67 AC 32 ms
5,376 KB
testcase_68 AC 34 ms
5,376 KB
testcase_69 AC 32 ms
5,376 KB
testcase_70 AC 32 ms
5,376 KB
testcase_71 AC 32 ms
5,376 KB
testcase_72 AC 32 ms
5,376 KB
testcase_73 AC 34 ms
5,376 KB
testcase_74 AC 31 ms
5,376 KB
testcase_75 AC 31 ms
5,376 KB
testcase_76 AC 32 ms
5,376 KB
testcase_77 AC 33 ms
5,376 KB
testcase_78 AC 34 ms
5,376 KB
testcase_79 AC 33 ms
5,376 KB
testcase_80 AC 33 ms
5,376 KB
testcase_81 AC 33 ms
5,376 KB
testcase_82 WA -
testcase_83 WA -
testcase_84 WA -
testcase_85 WA -
testcase_86 WA -
testcase_87 WA -
testcase_88 WA -
testcase_89 WA -
testcase_90 WA -
testcase_91 WA -
testcase_92 AC 2 ms
5,376 KB
testcase_93 AC 2 ms
5,376 KB
testcase_94 WA -
testcase_95 WA -
testcase_96 WA -
testcase_97 WA -
testcase_98 WA -
testcase_99 WA -
testcase_100 AC 1 ms
5,376 KB
testcase_101 WA -
testcase_102 AC 2 ms
5,376 KB
testcase_103 AC 2 ms
5,376 KB
testcase_104 AC 2 ms
5,376 KB
testcase_105 AC 2 ms
5,376 KB
testcase_106 AC 2 ms
5,376 KB
testcase_107 AC 2 ms
5,376 KB
testcase_108 AC 2 ms
5,376 KB
testcase_109 AC 1 ms
5,376 KB
testcase_110 AC 2 ms
5,376 KB
testcase_111 AC 2 ms
5,376 KB
testcase_112 AC 1 ms
5,376 KB
testcase_113 AC 1 ms
5,376 KB
testcase_114 AC 2 ms
5,376 KB
testcase_115 AC 2 ms
5,376 KB
testcase_116 AC 1 ms
5,376 KB
testcase_117 AC 2 ms
5,376 KB
testcase_118 AC 2 ms
5,376 KB
testcase_119 AC 2 ms
5,376 KB
testcase_120 AC 1 ms
5,376 KB
testcase_121 AC 2 ms
5,376 KB
testcase_122 AC 33 ms
5,376 KB
testcase_123 AC 53 ms
5,376 KB
testcase_124 AC 51 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")    
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 9999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(50) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 998244353
#define MAX 10000000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli A,B,C,D,E,F,K,N,M,L,X,Y,Z,H,W,sum=0,num=0,flag=0;string S,T;
  cin >> A >> B >> C;
  Vec(ans,_Float128,0,0.0);
  if(A==B&&B==C&&C==0)Out(-1);
  else if(A!=0){
    _Float128 limit=(_Float128)-B/(2*A);
    _Float128 eps=0.000000000001;
    _Float128 ok=limit;
    _Float128 ng=-pow(10,18)*9;
    Z=100000;
    while(Z--){
      _Float128 mid=(ok+ng)/2.0;
      if(A>0&&A*mid*mid+B*mid+C>0)ng=mid;
      else if(A<0&&A*mid*mid+B*mid+C<0)ng=mid;
      else ok=mid;
    }
    if(A*ok*ok+B*ok+C<0.000000000001&&-0.000000000001<A*ok*ok+B*ok+C)ans.pb(ok);
    ok=limit;
    ng=pow(10,18)*9;
    Z=100000;
    while(Z--){
      _Float128 mid=(ok+ng)/2.0;
      if(A>0&&A*mid*mid+B*mid+C>0)ng=mid;
      else if(A<0&&A*mid*mid+B*mid+C<0)ng=mid;
      else ok=mid;
    }
    if(A*ok*ok+B*ok+C<0.000000000001&&-0.000000000001<A*ok*ok+B*ok+C)ans.pb(ok);
  }
  else if(B!=0)ans.pb((_Float128)-C/B);  
  Out(ans.size());
  if(ans.size())for(auto v:ans)HpOut((long double)v);
}
  
0