提出 #42233273
ソースコード 拡げる
#include<cstdio>
#include<cstring>
#include<algorithm>
#define fep(i,x,y) for(int i=x;i<=y;i++)
#define feq(i,x,y) for(int i=x;i>=y;i--)
#define N 210000
using namespace std;
template<class T>
inline T mymin(T x,T y){return x<y?x:y;}
template<class T>
inline T mymax(T x,T y){return x>y?x:y;}
int a[N],n,b[N],n1,n2;
int c[N],m;
long double maxans=-999999999,minans=999999999;
int main(){
scanf("%d",&n);
fep(i,1,n){
int x;scanf("%d",&x);
if(x>0)a[++n1]=x;
else b[++n2]=x;
}
sort(a+1,a+n1+1);
sort(b+1,b+n2+1);
fep(i,1,n1){
if(i<=3 || i>=n1-2)c[++m]=a[i];
}
fep(i,1,n2){
if(i<=3 || i>=n2-2)c[++m]=b[i];
}
fep(i,1,m){
fep(j,i+1,m){
fep(k,j+1,m){
long double now=(c[i]+c[j]+c[k])*1.0/((long double)c[i]*c[j]*c[k]);
maxans=mymax(maxans,now);minans=mymin(minans,now);
}
}
}
printf("%.12Lf\n%.12Lf\n",minans,maxans);
return 0;
}
提出情報
コンパイルエラー
./Main.cpp: In function ‘int main()’:
./Main.cpp:16:7: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
16 | scanf("%d",&n);
| ~~~~~^~~~~~~~~
./Main.cpp:18:14: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
18 | int x;scanf("%d",&x);
| ~~~~~^~~~~~~~~
ジャッジ結果
| セット名 |
Sample |
All |
| 得点 / 配点 |
0 / 0 |
500 / 500 |
| 結果 |
|
|
| セット名 |
テストケース |
| Sample |
01_sample_01.txt, 01_sample_02.txt, 01_sample_03.txt |
| All |
01_sample_01.txt, 01_sample_02.txt, 01_sample_03.txt, 02_small_01.txt, 02_small_02.txt, 02_small_03.txt, 02_small_04.txt, 02_small_05.txt, 02_small_06.txt, 02_small_07.txt, 02_small_08.txt, 02_small_09.txt, 02_small_10.txt, 02_small_11.txt, 02_small_12.txt, 02_small_13.txt, 02_small_14.txt, 02_small_15.txt, 02_small_16.txt, 03_rand_1_01.txt, 03_rand_1_02.txt, 03_rand_1_03.txt, 03_rand_1_04.txt, 03_rand_1_05.txt, 04_rand_2_01.txt, 04_rand_2_02.txt, 04_rand_2_03.txt, 04_rand_2_04.txt, 04_rand_2_05.txt, 05_almost_negative_01.txt, 05_almost_negative_02.txt, 05_almost_negative_03.txt, 05_almost_negative_04.txt, 05_almost_negative_05.txt, 05_almost_negative_06.txt, 05_almost_negative_07.txt, 05_almost_negative_08.txt, 06_almost_positive_01.txt, 06_almost_positive_02.txt, 06_almost_positive_03.txt, 06_almost_positive_04.txt, 06_almost_positive_05.txt, 06_almost_positive_06.txt, 06_almost_positive_07.txt, 06_almost_positive_08.txt, 07_many_equal_01.txt, 07_many_equal_02.txt, 07_many_equal_03.txt |
| ケース名 |
結果 |
実行時間 |
メモリ |
| 01_sample_01.txt |
AC |
2 ms |
1712 KiB |
| 01_sample_02.txt |
AC |
5 ms |
1708 KiB |
| 01_sample_03.txt |
AC |
1 ms |
1708 KiB |
| 02_small_01.txt |
AC |
1 ms |
1700 KiB |
| 02_small_02.txt |
AC |
2 ms |
1636 KiB |
| 02_small_03.txt |
AC |
2 ms |
1644 KiB |
| 02_small_04.txt |
AC |
1 ms |
1640 KiB |
| 02_small_05.txt |
AC |
1 ms |
1644 KiB |
| 02_small_06.txt |
AC |
2 ms |
1704 KiB |
| 02_small_07.txt |
AC |
2 ms |
1640 KiB |
| 02_small_08.txt |
AC |
2 ms |
1648 KiB |
| 02_small_09.txt |
AC |
1 ms |
1696 KiB |
| 02_small_10.txt |
AC |
1 ms |
1708 KiB |
| 02_small_11.txt |
AC |
1 ms |
1700 KiB |
| 02_small_12.txt |
AC |
1 ms |
1644 KiB |
| 02_small_13.txt |
AC |
1 ms |
1700 KiB |
| 02_small_14.txt |
AC |
1 ms |
1696 KiB |
| 02_small_15.txt |
AC |
2 ms |
1644 KiB |
| 02_small_16.txt |
AC |
2 ms |
1708 KiB |
| 03_rand_1_01.txt |
AC |
40 ms |
2476 KiB |
| 03_rand_1_02.txt |
AC |
42 ms |
2416 KiB |
| 03_rand_1_03.txt |
AC |
43 ms |
2468 KiB |
| 03_rand_1_04.txt |
AC |
42 ms |
2416 KiB |
| 03_rand_1_05.txt |
AC |
40 ms |
2428 KiB |
| 04_rand_2_01.txt |
AC |
41 ms |
2488 KiB |
| 04_rand_2_02.txt |
AC |
41 ms |
2468 KiB |
| 04_rand_2_03.txt |
AC |
41 ms |
2420 KiB |
| 04_rand_2_04.txt |
AC |
45 ms |
2424 KiB |
| 04_rand_2_05.txt |
AC |
37 ms |
2480 KiB |
| 05_almost_negative_01.txt |
AC |
41 ms |
2488 KiB |
| 05_almost_negative_02.txt |
AC |
42 ms |
2420 KiB |
| 05_almost_negative_03.txt |
AC |
41 ms |
2428 KiB |
| 05_almost_negative_04.txt |
AC |
42 ms |
2420 KiB |
| 05_almost_negative_05.txt |
AC |
39 ms |
2424 KiB |
| 05_almost_negative_06.txt |
AC |
45 ms |
2428 KiB |
| 05_almost_negative_07.txt |
AC |
42 ms |
2416 KiB |
| 05_almost_negative_08.txt |
AC |
41 ms |
2424 KiB |
| 06_almost_positive_01.txt |
AC |
41 ms |
2488 KiB |
| 06_almost_positive_02.txt |
AC |
41 ms |
2476 KiB |
| 06_almost_positive_03.txt |
AC |
40 ms |
2424 KiB |
| 06_almost_positive_04.txt |
AC |
41 ms |
2428 KiB |
| 06_almost_positive_05.txt |
AC |
42 ms |
2472 KiB |
| 06_almost_positive_06.txt |
AC |
42 ms |
2488 KiB |
| 06_almost_positive_07.txt |
AC |
39 ms |
2428 KiB |
| 06_almost_positive_08.txt |
AC |
44 ms |
2428 KiB |
| 07_many_equal_01.txt |
AC |
31 ms |
2472 KiB |
| 07_many_equal_02.txt |
AC |
32 ms |
2424 KiB |
| 07_many_equal_03.txt |
AC |
33 ms |
2484 KiB |