Submission #100082

#TimeUsernameProblemLanguageResultExecution timeMemory
100082ryanseeSemiexpress (JOI17_semiexpress)C++14
Compilation error
0 ms0 KiB
#include "bits/stdc++.h" using namespace std; #define FAST ios_base::sync_with_stdio(false); cin.tie(0); #define LLINF (long long) 1e18//1234567890987654321 #define INF 1234567890l #define pb push_back #define ins insert #define f first #define s second #define db 0 #define EPS (1e-7) //0.0000001 the value #define PI (acos(-1)) #define MAXN 300006 #define MAXK 26 #define MAXX 15000006 #define ll long long int #define ld long double mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); //can be used by calling rng() or shuffle(A, A+n, rng) #define FOR(ii, ss, ee) for(ll ii = ss; ii < ee; ii++) #define space " " #define cbr cout << "hi\n" #define mmst(x, v) memset((x), v, sizeof ((x))) #define bg(ms) (*ms.begin()) #define ed(ms) (*prev(ms.end(), 1)) #define addedge(a, b, c, v) v[(a)].pb(pi((b), (c))); v[(b)].pb(pi((a), (c))) #define ph push #define btinpct(x) __builtin_popcountll(x) #define p2(x) (1LL<<(x)) #define all(x) (x).begin(), (x).end() #define lbd(x, y) lower_bound(all(x), y) #define ubd(x, y) upper_bound(all(x), y) typedef pair <ll, ll> pi; typedef pair <ll, pi> spi; typedef pair <pi, pi> dpi; inline ll rand(ll x, ll y) { ++y; return (rng() % (y-x)) + x; } //inclusivesss int n, m, k, a, b, c,TT,A[5006],dp[2][3006],val[3006]; ll T; ll bstar(ll x, ll from, ll to, ll left) // [from to) { // ll incur = 0; // for(ll i = from+1; i < to; i++) // { // incur += a; // if( incur > left) // { // if(x==0) return i-1; // incur -= a; // --x; // incur = ((i-from)*c); // if(incur > left) return i-1; // } // } ll at = from; ll ol = left; while(x) { at += (left/a); left %= a; if(at >= to - 1) return to-1; left = ol-((at+1)-from)*c; if(left < 0) return at; --x; at ++; } return min(at+(left/a),to-1); } int main() { FAST cin>>n>>m>>k>>a>>b>>c>>T; FOR(i,0,m)cin>>A[i]; A[m] = n+1;k-=m; for(ll i = 0; i < m; i++) { ll already = (A[i]-1)*b; if(T-already >= 0) dp[1][0]+=min(((T-already)/a + 1),A[i+1]-A[i]); } dp[1][0]--; // cerr << dp[1][0] << '\n'; // cerr<<dp[1][0]<<'\n'; for(ll i=1;i<=k;i++)dp[1][i]=dp[1][i-1]; for(ll i = 0; i < m; i++) { ll already = (A[i]-1)*b; ll far = min((T-already)/a+1,A[i+1]-A[i]); // cerr<<far<<' '<<A[i+1]<<' ' << A[i]<<'\n';assert(far>=1); // ll of=far; cerr<<already<<'\n'; for(ll j = 1; j <= k; j++) { val[j] = bstar(j,A[i],A[i+1],T-already)-(far+A[i]-1); // cerr << j << ' ' << far+A[i]-1 << ' ' << T-already << '\n'; // if(i==0&&j==1) cerr << "b:" << bstar(j,A[i],A[i+1],T-already)<<"\n"; } // cerr << val[1] << '\n'; // cerr << A[i] << ' ' << A[i]+far-1 << ' ' << val[1] << '\n'; if(T-already >= 0) { // cerr << i << ' ' << val[1] << '\n'; ll alt = i&1; for(ll j = 0; j <= k; j++) { for(ll w = k; w>=j; --w) { dp[alt][w]=max(dp[alt][w],dp[!alt][w-j]+val[j]); } } } for(ll j =0;j<=k;j++)dp[(i&1)][j]=max(dp[(i&1)][j],dp[!(i&1)][j]); mmst(dp[!(i&1)],0); } cout<<dp[(m-1)&1][k]<<"\n"; }

Compilation message (stderr)

semiexpress.cpp: In function 'int main()':
semiexpress.cpp:72:48: error: no matching function for call to 'min(long long int, int)'
   dp[1][0]+=min(((T-already)/a + 1),A[i+1]-A[i]);
                                                ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from semiexpress.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)
     min(const _Tp& __a, const _Tp& __b)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:195:5: note:   template argument deduction/substitution failed:
semiexpress.cpp:72:48: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   dp[1][0]+=min(((T-already)/a + 1),A[i+1]-A[i]);
                                                ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from semiexpress.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:243:5: note:   template argument deduction/substitution failed:
semiexpress.cpp:72:48: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   dp[1][0]+=min(((T-already)/a + 1),A[i+1]-A[i]);
                                                ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from semiexpress.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3450:5: note: candidate: template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)
     min(initializer_list<_Tp> __l)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3450:5: note:   template argument deduction/substitution failed:
semiexpress.cpp:72:48: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   dp[1][0]+=min(((T-already)/a + 1),A[i+1]-A[i]);
                                                ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from semiexpress.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3456:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)
     min(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3456:5: note:   template argument deduction/substitution failed:
semiexpress.cpp:72:48: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   dp[1][0]+=min(((T-already)/a + 1),A[i+1]-A[i]);
                                                ^
semiexpress.cpp:79:69: error: no matching function for call to 'min(long long int, int)'
   ll already = (A[i]-1)*b;  ll far = min((T-already)/a+1,A[i+1]-A[i]); // cerr<<far<<' '<<A[i+1]<<' ' << A[i]<<'\n';assert(far>=1);
                                                                     ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from semiexpress.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)
     min(const _Tp& __a, const _Tp& __b)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:195:5: note:   template argument deduction/substitution failed:
semiexpress.cpp:79:69: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   ll already = (A[i]-1)*b;  ll far = min((T-already)/a+1,A[i+1]-A[i]); // cerr<<far<<' '<<A[i+1]<<' ' << A[i]<<'\n';assert(far>=1);
                                                                     ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from semiexpress.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:243:5: note:   template argument deduction/substitution failed:
semiexpress.cpp:79:69: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   ll already = (A[i]-1)*b;  ll far = min((T-already)/a+1,A[i+1]-A[i]); // cerr<<far<<' '<<A[i+1]<<' ' << A[i]<<'\n';assert(far>=1);
                                                                     ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from semiexpress.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3450:5: note: candidate: template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)
     min(initializer_list<_Tp> __l)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3450:5: note:   template argument deduction/substitution failed:
semiexpress.cpp:79:69: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   ll already = (A[i]-1)*b;  ll far = min((T-already)/a+1,A[i+1]-A[i]); // cerr<<far<<' '<<A[i+1]<<' ' << A[i]<<'\n';assert(far>=1);
                                                                     ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from semiexpress.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3456:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)
     min(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3456:5: note:   template argument deduction/substitution failed:
semiexpress.cpp:79:69: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   ll already = (A[i]-1)*b;  ll far = min((T-already)/a+1,A[i+1]-A[i]); // cerr<<far<<' '<<A[i+1]<<' ' << A[i]<<'\n';assert(far>=1);
                                                                     ^