제출 #1062683

#제출 시각아이디문제언어결과실행 시간메모리
1062683TimDeePeru (RMI20_peru)C++17
컴파일 에러
0 ms0 KiB
#include "peru.h" #include <bits/stdc++.h> using namespace std; #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("popcnt,avx2") using ll = long long; const int N=25e5+5; ll dp[N]; int solve(int n, int k, int* v){ const int mod = 1e9+7; #define int long long #define forn(i,n) for(int i=0; i<(n); ++i) #define pb push_back #define pi pair<int,int> #define f first #define s second deque<pi> s; deque<pi> z; ll ans=0; int ptr=0; int R=0; forn(i,n) { while (s.size() && s[0].s<=i-k) { s.pop_front(); --ptr; } while (z.size() && z[0].s<=i-k) z.pop_front(); while (s.size() && s.back().f < v[i]) { ptr=min(ptr,1ll*s.size()); s.pop_back(); } if (s.size()) { while (z.size() && z.back().s > s.back().s) z.pop_back(); if (s.back().s<i-1) z.push_back({dp[s.back().s]+v[i],s.back().s+1}); } else { while (z.size()) z.pop_back(); if (k>1 && i-k>=0) z.push_back({dp[i-k]+v[i],i-k+1}); } s.pb({v[i],i}); if (i-k>=0) { R=max(R,i-k); while (dp[R]==dp[R+1]) ++R; while (s[ptr].s<=R) ++ptr; if (z.size()) if (dp[R]+s[ptr].f <= z.front().f) z.push_front({dp[R]+s[ptr].f,R}); } dp[i]=s[0].f; if (i-k>=0) dp[i]+=dp[i-k]; if (i) dp[i]=min(dp[i],dp[i-1]+v[i]); if (z.size()) dp[i] = min(dp[i],z[0].f); if (i) { while (z.size() && z.back().f > dp[i-1]+v[i]) z.pop_back(); z.pb({dp[i-1]+v[i],i}); } else { while (z.size() && z.back().f > v[i]) z.pop_back(); z.pb({v[i],i}); } ans=(ans*23)%mod; ans=(ans+dp[i])%mod; } return ans; #undef int }

컴파일 시 표준 에러 (stderr) 메시지

peru.cpp: In function 'int solve(int, int, int*)':
peru.cpp:33:37: error: no matching function for call to 'min(long long int&, long long unsigned int)'
   33 |             ptr=min(ptr,1ll*s.size());
      |                                     ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from peru.cpp:2:
/usr/include/c++/10/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
peru.cpp:33:37: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
   33 |             ptr=min(ptr,1ll*s.size());
      |                                     ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from peru.cpp:2:
/usr/include/c++/10/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
peru.cpp:33:37: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
   33 |             ptr=min(ptr,1ll*s.size());
      |                                     ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from peru.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:3468:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3468 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
peru.cpp:33:37: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   33 |             ptr=min(ptr,1ll*s.size());
      |                                     ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from peru.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3474:5: note:   template argument deduction/substitution failed:
peru.cpp:33:37: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   33 |             ptr=min(ptr,1ll*s.size());
      |                                     ^