QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#418631#5122. Strange SumreverSillyCompile Error//C++23429b2024-05-23 14:55:012024-05-23 14:55:02

Judging History

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

  • [2024-05-23 14:55:02]
  • 评测
  • [2024-05-23 14:55:01]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
constexpr int mxn{100005};
int n;
set<int,greater<>>a;
int main()
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin>>n;
    for(int i=0,ai;i<n;++i)
    {
        cin>>ai;
        a.insert(ai);
    }
    int ans=0;
    ans+=max(*a.front(),0);
    a.erase(a.front());
    if(!a.empty())
        ans+=max(*a.front(),0);
    cout<<ans;
    return 0;
}

Details

answer.code: In function ‘int main()’:
answer.code:17:17: error: ‘class std::set<int, std::greater<void> >’ has no member named ‘front’
   17 |     ans+=max(*a.front(),0);
      |                 ^~~~~
answer.code:18:15: error: ‘class std::set<int, std::greater<void> >’ has no member named ‘front’
   18 |     a.erase(a.front());
      |               ^~~~~
answer.code:20:21: error: ‘class std::set<int, std::greater<void> >’ has no member named ‘front’
   20 |         ans+=max(*a.front(),0);
      |                     ^~~~~