QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#357522#3056. Live ProgrammingKevin5307Compile Error//C++201.5kb2024-03-18 22:18:012024-03-18 22:18:01

Judging History

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

  • [2024-03-18 22:18:01]
  • 评测
  • [2024-03-18 22:18:01]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int n,t;
ll f[4004],p[4004],l[4004];
ll dp[4004][4004];
deque<pair<ll,ll>> dq[4004];
struct fraction
{
	ll x,y;
	fraction(){}
	fraction(ll x,ll y):x(x),y(y){}
	const friend bool operator <(const fraction &a,const fraction &b)
	{
		return (__int128)(a.x)*b.y<(__int128)(a.y)*b.x;
	}
};
fraction slope(pair<ll,ll> a,pair<ll,ll> b)
{
	return fraction((b.first-a.first),(b.second-a.second));
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n>>t;
	for(int i=1;i<=n;i++)
		cin>>l[i]>>p[i]>>f[i];
	for(int i=1;i<=n;i++)
		for(int j=1;j<n;j++)
			if(f[j]>f[j+1])
			{
				swap(f[j],f[j+1]);
				swap(p[j],p[j+1]);
				swap(l[j],l[j+1]);
			}
	for(int i=0;i<=n;i++)
		for(int j=0;j<=t;j++)
			dp[i][j]=-1e14;
	dp[0][0]=0;
	for(int i=1;i<=n;i++)
	{
		for(int j=0;j<=t;j++) if(dp[i-1][j]>=-1e13)
		{
			ll vy=dp[i-1][j]-f[i-1]*f[i-1];
			ll vx=f[i-1]+f[i-1];
			while(dq[j].size()>1&&slope(dq[j][dq[j].size()-2],dq[j].back())<=slope(dq[j].back(),pair<ll,ll>(vy,vx)))
				dq[j].pop_back();
			dq[j].emplace_back(vy,vx);
		}
		for(int j=0;j<=t-l[i];j++) if(dq[j].size())
		{
			while(dq[j].size()>1&&fraction(-f[i],1)<=slope(dq[j][0],dq[j][1]))
				dq[j].pop_front();
			dp[i][j+l[i]]=dq[j][0].first+dq[j][0].second*f[i]-f[i]*f[i]+p[i];
		}
		dp[i][l[i]]=max(dp[i][l[i]],p[i]);
	}
	ll ans=0;
	for(int i=0;i<=n;i++)
		for(int j=0;j<=t;j++)
			ans=max(ans,dp[i][j]);
	cout<<ans<<endl;
	return 0;
}

Details

answer.code: In function ‘int main()’:
answer.code:48:88: error: no match for ‘operator<=’ (operand types are ‘fraction’ and ‘fraction’)
   48 |                         while(dq[j].size()>1&&slope(dq[j][dq[j].size()-2],dq[j].back())<=slope(dq[j].back(),pair<ll,ll>(vy,vx)))
      |                                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                    |                                          |
      |                                                    fraction                                   fraction
In file included from /usr/include/c++/13/regex:68,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:181,
                 from answer.code:1:
/usr/include/c++/13/bits/regex.h:1288:5: note: candidate: ‘template<class _Bi_iter, class _Ch_traits, class _Alloc> auto std::__cxx11::operator<=>(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)’ (reversed)
 1288 |     operator<=>(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/regex.h:1288:5: note:   template argument deduction/substitution failed:
answer.code:48:127: note:   ‘fraction’ is not derived from ‘const std::__cxx11::sub_match<_BiIter>’
   48 |                         while(dq[j].size()>1&&slope(dq[j][dq[j].size()-2],dq[j].back())<=slope(dq[j].back(),pair<ll,ll>(vy,vx)))
      |                                                                                                                               ^
/usr/include/c++/13/bits/regex.h:1456:5: note: candidate: ‘template<class _Bi_iter> auto std::__cxx11::operator<=>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)’ (reversed)
 1456 |     operator<=>(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/regex.h:1456:5: note:   template argument deduction/substitution failed:
answer.code:48:127: note:   ‘fraction’ is not derived from ‘const std::__cxx11::sub_match<_BiIter>’
   48 |                         while(dq[j].size()>1&&slope(dq[j][dq[j].size()-2],dq[j].back())<=slope(dq[j].back(),pair<ll,ll>(vy,vx)))
      |                                                                                                                               ^
/usr/include/c++/13/bits/regex.h:1629:5: note: candidate: ‘template<class _Bi_iter> auto std::__cxx11::operator<=>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)’ (reversed)
 1629 |     operator<=>(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/13/bits/regex.h:1629:5: note:   template argument deduction/substitution failed:
answer.code:48:127: note:   ‘fraction’ is not derived from ‘const std::__cxx11::sub_match<_BiIter>’
   48 |                         while(dq[j].size()>1&&slope(dq[j][dq[j].size()-2],dq[j].back())<=slope(dq[j].back(),pair<ll,ll>(vy,vx)))
      |                                                                                                                               ^
In file included from /usr/include/c++/13/bits/stl_algobase.h:67,
                 from /usr/include/c++/13/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51:
/usr/include/c++/13/bits/stl_iterator.h:583:5: note: candidate: ‘template<class _IteratorL, class _IteratorR>  requires  three_way_comparable_with<_IteratorR, _IteratorL, std::partial_ordering> constexpr std::compare_three_way_result_t<_IteratorL, _IteratorR> std::operator<=>(const reverse_iterator<_IteratorL>&, const reverse_iterator<_IteratorR>&)’ (reversed)
  583 |     operator<=>(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/13/bits/stl_iterator.h:583:5: note:   template argument deduction/substitution failed:
answer.code:48:127: note:   ‘fraction’ is not derived from ‘const std::reverse_iterator<_IteratorL>’
   48 |                         while(dq[j].size()>1&&slope(dq[j][dq[j].size()-2],dq[j].back())<=slope(dq[j].back(),pair<ll,ll>(vy,vx)))
      |                                                                                                                               ^
/usr/include/c++/13/bits/stl_iterator.h:1690:5: note: candidate: ‘template<class _IteratorL, class _IteratorR>  requires  three_way_comparable_with<_IteratorR, _IteratorL, std::partial_ordering> constexpr std::compare_three_way_result_t<_IteratorL, _IteratorR> std::operator<=>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)’ (reversed)
 1690 |     operator<=>(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/13/bits/stl_iterator.h:1690:5: note:   template argument deduction/substitution failed:
answer.code:48:127: note:   ‘fraction’ is not derived from ‘const std::move_iterator<_IteratorL>’
   48 |                         while(dq[j].size()>1&&slope(dq[j][dq[j].size()-2],dq[j].back())<=slope(dq[j].back(),pair<ll,ll...