QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#772460 | #5146. Skills | songszh | Compile Error | / | / | C++14 | 3.9kb | 2024-11-22 19:40:13 | 2024-11-22 19:40:17 |
Judging History
answer
#include <bits/stdc++.h>
// #define int long long
#define ll long long
#define ull unsigned long long
#define db double
#define ld long double
#define rep(i,l,r) for (int i = (int)(l); i <= (int)(r); ++ i )
#define rep1(i,l,r) for (int i = (int)(l); i >= (int)(r); -- i )
#define il inline
#define fst first
#define snd second
#define ptc putchar
#define Yes ptc('Y'),ptc('e'),ptc('s'),puts("")
#define No ptc('N'),ptc('o'),puts("")
#define YES ptc('Y'),ptc('E'),ptc('S'),puts("")
#define NO ptc('N'),ptc('O'),puts("")
#define pb emplace_back
#define sz(x) (int)(x.size())
#define all(x) x.begin(),x.end()
#define get(x) ((x - 1) / len + 1)
#define debug() puts("------------")
using namespace std;
typedef pair<int,int> PII;
typedef pair<int,PII> PIII;
typedef pair<ll,ll> PLL;
namespace szhqwq {
template<class T> il void read(T &x) {
x = 0; T f = 1; char ch = getchar();
while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
while (ch >= '0' && ch <= '9') { x = (x << 3) + (x << 1) + (ch ^ 48); ch = getchar(); }
x *= f;
}
template<class T,class... Args> il void read(T &x,Args &...x_) { read(x); read(x_...); }
template<class T> il void print(T x) {
if (x < 0) ptc('-'), x = -x;
if (x > 9) print(x / 10); ptc(x % 10 + '0');
}
template<class T,class T_> il void write(T x,T_ ch) { print(x); ptc(ch); }
template<class T,class T_> il void chmax(T &x,T_ y) { x = max(x,y); }
template<class T,class T_> il void chmin(T &x,T_ y) { x = min(x,y); }
template<class T,class T_,class T__> il T qmi(T a,T_ b,T__ p) {
T res = 1; while (b) {
if (b & 1) res = res * a % p;
a = a * a % p; b >>= 1;
} return res;
}
template<class T> il T gcd(T a,T b) { if (!b) return a; return gcd(b,a % b); }
template<class T,class T_> il void exgcd(T a, T b, T_ &x, T_ &y) {
if (b == 0) { x = 1; y = 0; return; }
exgcd(b,a % b,y,x); y -= a / b * x; return ;
}
template<class T,class T_> il T getinv(T x,T_ p) { T inv,y; exgcd(x,(T)p,inv,y); inv = (inv + p) % p; return inv; }
} using namespace szhqwq;
const int N = 1010,inf = 1e9,mod = 998244353;
const ull base = 131,base_ = 233;
const ll inff = 1e18;
int n,a[N][3];
int f[N][210][210],g[N][210][210],h[N][210][210];
il int p(int x) {
return !x ? x : x + 1;
}
il void solve() {
//------------code------------
read(n);
rep(i,1,n) read(a[i][0],a[i][1],a[i][2]);
memset(f,-1,sizeof f); memset(g,-1,sizeof g); memset(h,-1,sizeof h);
f[0][0][0] = g[0][0][0] = h[0][0][0] = 0;
rep(i,0,n - 1)
rep(j,0,min(200,n))
rep(k,0,min(200,n)) {
if (~f[i][j][k]){
chmax(f[i + 1][p(j)][p(k)],f[i][j][k] + a[i + 1][0] - p(j) - p(k));
chmax(g[i + 1][1][p(k)],f[i][j][k] + a[i + 1][1] - p(k) - 1);
chmax(h[i + 1][1][p(k)],f[i][j][k] + a[i + 1][2] - p(k) - 1);
}
if (~g[i][j][k]) {
chmax(f[i + 1][1][p(k)],g[i][j][k] + a[i + 1][0] - 1 - p(k));
chmax(g[i + 1][p(j)][p(k)],g[i][j][k] + a[i + 1][1] - p(j) - p(k));
chmax(h[i + 1][p(j)][1],g[i][j][k] + a[i + 1][2] - p(j) - 1ll);
}
if (~h[i][j][k]) {
chmax(f[i + 1][1][p(k)],h[i][j][k] + a[i + 1][0] - 1 - p(k));
chmax(g[i + 1][p(j)][1],h[i][j][k] + a[i + 1][1] - p(j) - 1);
chmax(h[i + 1][p(j)][p(k)],h[i][j][k] + a[i + 1][2] - p(j) - p(k));
}
}
ll ret = 0;
rep(j,0,min(200,n)) rep(k,0,min(200,n)) chmax(ret,max({f[n][j][k],g[n][j][k],h[n][j][k]}));
write(ret,'\n');
return ;
}
il void init() {
return ;
}
signed main() {
// init();
int _ = 1;
read(_);
while (_ -- ) solve();
return 0;
}
Details
answer.code: In instantiation of ‘void szhqwq::chmax(T&, T_) [with T = int; T_ = long long int]’: answer.code:83:26: required from here answer.code:41:66: error: no matching function for call to ‘max(int&, long long int&)’ 41 | template<class T,class T_> il void chmax(T &x,T_ y) { x = max(x,y); } | ~~~^~~~~ In file included from /usr/include/c++/13/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51, from answer.code:1: /usr/include/c++/13/bits/stl_algobase.h:257:5: note: candidate: ‘template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)’ 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: answer.code:41:66: note: deduced conflicting types for parameter ‘const _Tp’ (‘int’ and ‘long long int’) 41 | template<class T,class T_> il void chmax(T &x,T_ y) { x = max(x,y); } | ~~~^~~~~ /usr/include/c++/13/bits/stl_algobase.h:303:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’ 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:303:5: note: template argument deduction/substitution failed: answer.code:41:66: note: deduced conflicting types for parameter ‘const _Tp’ (‘int’ and ‘long long int’) 41 | template<class T,class T_> il void chmax(T &x,T_ y) { x = max(x,y); } | ~~~^~~~~ In file included from /usr/include/c++/13/algorithm:61: /usr/include/c++/13/bits/stl_algo.h:5795:5: note: candidate: ‘template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)’ 5795 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/13/bits/stl_algo.h:5795:5: note: template argument deduction/substitution failed: answer.code:41:66: note: mismatched types ‘std::initializer_list<_Tp>’ and ‘int’ 41 | template<class T,class T_> il void chmax(T &x,T_ y) { x = max(x,y); } | ~~~^~~~~ /usr/include/c++/13/bits/stl_algo.h:5805:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)’ 5805 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/13/bits/stl_algo.h:5805:5: note: template argument deduction/substitution failed: answer.code:41:66: note: mismatched types ‘std::initializer_list<_Tp>’ and ‘int’ 41 | template<class T,class T_> il void chmax(T &x,T_ y) { x = max(x,y); } | ~~~^~~~~ answer.code: In instantiation of ‘void szhqwq::chmax(T&, T_) [with T = long long int; T_ = int]’: answer.code:92:50: required from here answer.code:41:66: error: no matching function for call to ‘max(long long int&, int&)’ /usr/include/c++/13/bits/stl_algobase.h:257:5: note: candidate: ‘template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)’ 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: answer.code:41:66: note: deduced conflicting types for parameter ‘const _Tp’ (‘long long int’ and ‘int’) 41 | template<class T,class T_> il void chmax(T &x,T_ y) { x = max(x,y); } | ~~~^~~~~ /usr/include/c++/13/bits/stl_algobase.h:303:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’ 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:303:5: note: template argument deduction/substitution failed: answer.code:41:66: note: deduced conflicting types for parameter ‘const _Tp’ (‘long long int’ and ‘int’) 41 | template<class T,class T_> il void chmax(T &x,T_ y) { x = max(x,y); } | ~~~^~~~~ /usr/include/c++/13/bits/stl_algo.h:5795:5: note: candidate: ‘template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)’ 5795 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/13/bits/stl_algo.h:5795:5: note: template argument deduction/substitution failed: answer.code:41:66: note: mismatched types ‘std::initializer_list<_Tp>’ and ‘long long int’ 41 | template<class T,class T_> il void chmax(T &x,T_ y) { x = max(x,y); } | ~~~^~~~~ /usr/include/c++/13/bits/stl_algo.h:5805:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr _Tp std::max(...