QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#617757#7875. Queue SortingjieloscCompile Error//C++201.4kb2024-10-06 16:56:022024-10-06 16:56:03

Judging History

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

  • [2024-10-06 16:56:03]
  • 评测
  • [2024-10-06 16:56:02]
  • 提交

answer

#include <bits/stdc++.h>
#define int int64_t

using std::cin;
using std::cout;
const char endl = '\n';

const int p = 998244353;

const int N = 506;
int a[N], sum[N];
int f[N][N];
int C[N][N] = {1};

void solve() {
  for (int i = 1; i < N; ++i) {
    C[i][0] = 1;
    for (int j = 1; j < N; ++j) {
      C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % p;
    }
  }
  int n;
  std::cin >> n;
  for (int i = 1; i <= n; ++i) cin >> a[i], sum[i] = sum[i - 1] + a[i];
  for (int i = 1; i <= n; ++i) f[0][i] = f[i][n] = 1;
  for (int i = n - 1; i; --i) {
    if (a[i] == 0) continue;
    for (int j = 1; j <= sum[n] - sum[i - 1]; ++j) {
      if(n - j >= sum[i]) f[j][i] = (f[j][i] + f[j][i + 1]) % p;
      for (int l = 0; l <= std::min(j, sum[n] - sum[i]); ++l) {
        for (int k = std::max(0ll, sum[i] - (n - j + 1));
             k <= std::min(a[i] - 1, j - l - 1);
             ++k) {
          f[j][i] = (f[j][i] + f[l][i + 1] * C[j - l - 1][k] % p) % p; 
        }
      }
      // cout << j<<" " << i<<" " << f[j][i] << endl;
    }
  }
  cout << f[n][1] << endl;
}

int32_t main() {
#ifndef _DEBUG
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
#endif
  int tc = 1;
  // std::cin >> tc;
  while (tc--) solve();
#ifdef _DEBUG
  std::cout << std::endl;
  std::cout << "Time used: " << clock() << "ms" << std::endl;
#endif
  return 0;
}

詳細信息

answer.code: In function ‘void solve()’:
answer.code:31:30: error: no matching function for call to ‘max(long long int, int64_t)’
   31 |         for (int k = std::max(0ll, sum[i] - (n - j + 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: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:31:30: note:   deduced conflicting types for parameter ‘const _Tp’ (‘long long int’ and ‘int64_t’ {aka ‘long int’})
   31 |         for (int k = std::max(0ll, sum[i] - (n - j + 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:31:30: note:   deduced conflicting types for parameter ‘const _Tp’ (‘long long int’ and ‘int64_t’ {aka ‘long int’})
   31 |         for (int k = std::max(0ll, sum[i] - (n - j + 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:
answer.code:31:30: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘long long int’
   31 |         for (int k = std::max(0ll, sum[i] - (n - j + 1));
      |                      ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:31:30: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘long long int’
   31 |         for (int k = std::max(0ll, sum[i] - (n - j + 1));
      |                      ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~