QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#312691#5146. SkillsNCl3Compile Error//C++142.6kb2024-01-24 10:44:572024-01-24 10:44:59

Judging History

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

  • [2024-01-24 10:44:59]
  • 评测
  • [2024-01-24 10:44:57]
  • 提交

answer

#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define endl '\n'
#define int long long
#define vi vector<int>
using namespace std;
typedef pair<int, int> pii;
constexpr int N=210;
constexpr int inf = 1e18;
struct A
{
    int a;
    bool operator<(const A &t) const
    {
        return a < t.a;
    }
};
// priority_queue<pii, vector<pii>, greater<pii>> heap;
// cout << setprecision(n)
void solve()
{
    int n;
    cin>>n;
    // f[n][150][150][150]
    vector<array<int,3>> a(n+1);
    for(int i=1;i<=n;i++)
        for(int j=0;j<3;j++)
            cin >> a[i][j];
        
    vector f(3,vector(N,vector(N,vector(N,0ll))));
    for(int i=0;i<n;i++){
        //0
        int nxt=i&1^1,cur=i&1;
        cout<<cur<<' '<<nxt<<endl;
        for(int j=0;j<N;j++)
            for(int k=0;k<N;k++){
                int t=0;
                int tj = j + (j != 0), tk = k + (k != 0);
                if(tj<N&&tk<N){
                    for (int l = 0; l < N; l++)
                        t = max(t, f[cur][l][j][k]);
                        f[nxt][1][tj][tk] = max(f[nxt][1][tj][tk], t+a[i+1][0] - j - k);
                }
            
            }

        //1
        for(int j=0;j<N;j++)
            for(int k=0;k<N;k++){
                int t=0;
                int tj = j + (j != 0), tk = k + (k != 0);
                if (tj < N && tk < N)
                {
                    for (int l = 0; l < N; l++)
                        t = max(t, f[cur][j][l][k]);
                        f[nxt][tj][1][tk] = max(f[nxt][tj][1][tk], t+a[i+1][1] - j - k);
                }
            }

        //2
        for (int j = 0; j < N; j++)
            for (int k = 0; k < N; k++)
            {
                int t = 0;
                int tj = j + (j != 0), tk = k + (k != 0);
                if (tj < N && tk < N)
                {
                    for (int l = 0; l < N; l++)
                        t = max(t, f[cur][j][k][l]);
                        f[nxt][tj][tk][1] = max(f[nxt][tj][tk][1], t+a[i+1][2] - j - k);
                }
            }
    }

    int ans=0;
    for (int j = 0; j < N; j++)
        for (int k = 0; k < N; k++)
            ans=max({ans,(f[n&1][1][j][k]),(f[n&1][j][1][k]),(f[n&1][j][k][1])});
            
    // cout<<f[2][0][1][2]<<' '<<f[1][0][1][0]<<' '<<f[1][0][0][1]<<endl;
    cout << ans << endl;
}
signed main()
{
    // freopen("data3.in", "r", stdin);
    // freopen("data3.out", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    cin>>t;
    while (t--)
    {
        solve();
    }

    return 0;
}

Details

answer.code: In function ‘void solve()’:
answer.code:30:12: error: missing template arguments before ‘f’
   30 |     vector f(3,vector(N,vector(N,vector(N,0ll))));
      |            ^
answer.code:41:36: error: ‘f’ was not declared in this scope
   41 |                         t = max(t, f[cur][l][j][k]);
      |                                    ^
answer.code:42:25: error: ‘f’ was not declared in this scope
   42 |                         f[nxt][1][tj][tk] = max(f[nxt][1][tj][tk], t+a[i+1][0] - j - k);
      |                         ^
answer.code:55:36: error: ‘f’ was not declared in this scope
   55 |                         t = max(t, f[cur][j][l][k]);
      |                                    ^
answer.code:56:25: error: ‘f’ was not declared in this scope
   56 |                         f[nxt][tj][1][tk] = max(f[nxt][tj][1][tk], t+a[i+1][1] - j - k);
      |                         ^
answer.code:69:36: error: ‘f’ was not declared in this scope
   69 |                         t = max(t, f[cur][j][k][l]);
      |                                    ^
answer.code:70:25: error: ‘f’ was not declared in this scope
   70 |                         f[nxt][tj][tk][1] = max(f[nxt][tj][tk][1], t+a[i+1][2] - j - k);
      |                         ^
answer.code:78:27: error: ‘f’ was not declared in this scope
   78 |             ans=max({ans,(f[n&1][1][j][k]),(f[n&1][j][1][k]),(f[n&1][j][k][1])});
      |                           ^
answer.code:78:20: error: no matching function for call to ‘max(<brace-enclosed initializer list>)’
   78 |             ans=max({ans,(f[n&1][1][j][k]),(f[n&1][j][1][k]),(f[n&1][j][k][1])});
      |                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:2:
/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:78:20: note:   candidate expects 2 arguments, 1 provided
   78 |             ans=max({ans,(f[n&1][1][j][k]),(f[n&1][j][1][k]),(f[n&1][j][k][1])});
      |                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:78:20: note:   candidate expects 3 arguments, 1 provided
   78 |             ans=max({ans,(f[n&1][1][j][k]),(f[n&1][j][1][k]),(f[n&1][j][k][1])});
      |                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:
/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: