QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#649202#8242. V-DiagramAa#Compile Error//C++17799b2024-10-17 22:03:502024-10-17 22:03:54

Judging History

你现在查看的是最新测评结果

  • [2024-10-17 22:03:54]
  • 评测
  • [2024-10-17 22:03:50]
  • 提交

answer

、#include <iostream>
#include <algorithm>
using namespace std;
const double INF=1e18;
int n;
int a[300010];
double s[300010];
bool check(double mid){
	for(int i=1;i<=n;i++)
		s[i]=s[i-1]+(double)a[i]-mid;
	double mi=INF;
	for(int i=1;i<n;i++){
		if(a[i]>a[i+1]) mi=min(mi,s[i-1]);
		else if(a[i]==a[i+1]) mi=INF;
		else if(mi!=INF){
			int j=i+1;
			while(j<=n && a[j]>a[j-1]){
				if(s[j++]-mi>=0) return true;
			}
			mi=INF;
			i=j-2;
		}
	}
	return false;
}
signed main(){
	int t;
	scanf("%d",&t);
	while(t--){
		double l=0,r=0;
		scanf("%d",&n);
		for(int i=1;i<=n;i++){
			scanf("%d",&a[i]);
			r=max(r,(double)a[i]);
		}
		while(r-l>1e-6){
			double mid=(l+r)/2;
			if(check(mid)) l=mid;
			else r=mid;
		}
		printf("%.18lf\n",r);
	}
	return 0;
} 

详细

answer.code:1:1: error: extended character 、 is not valid in an identifier
    1 | 、#include <iostream>
      | ^
answer.code:1:3: error: stray ‘#’ in program
    1 | 、#include <iostream>
      |   ^
answer.code:1:1: error: ‘、’ does not name a type
    1 | 、#include <iostream>
      | ^~
In file included from /usr/include/c++/13/bits/stl_algobase.h:62,
                 from /usr/include/c++/13/algorithm:60,
                 from answer.code:2:
/usr/include/c++/13/ext/type_traits.h:164:35: error: ‘constexpr const bool __gnu_cxx::__is_null_pointer’ redeclared as different kind of entity
  164 |   __is_null_pointer(std::nullptr_t)
      |                                   ^
/usr/include/c++/13/ext/type_traits.h:159:5: note: previous declaration ‘template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)’
  159 |     __is_null_pointer(_Type)
      |     ^~~~~~~~~~~~~~~~~
/usr/include/c++/13/ext/type_traits.h:164:26: error: ‘nullptr_t’ is not a member of ‘std’
  164 |   __is_null_pointer(std::nullptr_t)
      |                          ^~~~~~~~~
In file included from /usr/include/c++/13/bits/stl_pair.h:60,
                 from /usr/include/c++/13/bits/stl_algobase.h:64:
/usr/include/c++/13/type_traits:275:27: error: ‘size_t’ has not been declared
  275 |   template <typename _Tp, size_t = sizeof(_Tp)>
      |                           ^~~~~~
/usr/include/c++/13/type_traits:510:26: error: ‘std::size_t’ has not been declared
  510 |   template<typename _Tp, std::size_t _Size>
      |                          ^~~
/usr/include/c++/13/type_traits:511:25: error: ‘_Size’ was not declared in this scope
  511 |     struct is_array<_Tp[_Size]>
      |                         ^~~~~
/usr/include/c++/13/type_traits:511:31: error: template argument 1 is invalid
  511 |     struct is_array<_Tp[_Size]>
      |                               ^
/usr/include/c++/13/type_traits:617:33: error: ‘nullptr_t’ is not a member of ‘std’
  617 |     struct is_null_pointer<std::nullptr_t>
      |                                 ^~~~~~~~~
/usr/include/c++/13/type_traits:617:42: error: template argument 1 is invalid
  617 |     struct is_null_pointer<std::nullptr_t>
      |                                          ^
/usr/include/c++/13/type_traits:621:48: error: template argument 1 is invalid
  621 |     struct is_null_pointer<const std::nullptr_t>
      |                                                ^
/usr/include/c++/13/type_traits:625:51: error: template argument 1 is invalid
  625 |     struct is_null_pointer<volatile std::nullptr_t>
      |                                                   ^
/usr/include/c++/13/type_traits:629:57: error: template argument 1 is invalid
  629 |     struct is_null_pointer<const volatile std::nullptr_t>
      |                                                         ^
/usr/include/c++/13/type_traits:914:26: error: ‘size_t’ has not been declared
  914 |   template<typename _Tp, size_t _Size>
      |                          ^~~~~~
/usr/include/c++/13/type_traits:915:40: error: ‘_Size’ was not declared in this scope
  915 |     struct __is_array_known_bounds<_Tp[_Size]>
      |                                        ^~~~~
/usr/include/c++/13/type_traits:915:46: error: template argument 1 is invalid
  915 |     struct __is_array_known_bounds<_Tp[_Size]>
      |                                              ^
/usr/include/c++/13/type_traits:1348:37: error: ‘size_t’ is not a member of ‘std’
 1348 |     : public integral_constant<std::size_t, alignof(_Tp)>
      |                                     ^~~~~~
/usr/include/c++/13/type_traits:1348:57: error: template argument 1 is invalid
 1348 |     : public integral_constant<std::size_t, alignof(_Tp)>
      |                                                         ^
/usr/include/c++/13/type_traits:1348:57: note: invalid template non-type parameter
/usr/include/c++/13/type_traits:1357:37: error: ‘size_t’ is not a member of ‘std’
 1357 |     : public integral_constant<std::size_t, 0> { };
      |                                     ^~~~~~
/usr/include/c++/13/type_traits:1357:46: error: template argument 1 is invalid
 1357 |     : public integral_constant<std::size_t, 0> { };
      |                                              ^
/usr/include/c++/13/type_traits:1357:46: note: invalid template non-type parameter
/usr/include/c++/13/type_traits:1359:26: error: ‘std::size_t’ has not been declared
 1359 |   template<typename _Tp, std::size_t _Size>
      |                          ^~~
/usr/include/c++/13/type_traits:1360:21: error: ‘_Size’ was not declared in this scope
 1360 |     struct rank<_Tp[_Size]>
      |                     ^~~~~
/usr/include/c++/13/type_traits:1360:27: error: template argument 1 is invalid
 1360 |     struct rank<_Tp[_Size]>
      |                           ^
/usr/include/c++/13/type_traits:1361:37: error: ‘size_t’ is not a member of ‘std’
 1361 |     : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
      |        ...