QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#554566#8780. Training, Round 2appearCompile Error//C++141.3kb2024-09-09 12:17:222024-09-09 12:17:22

Judging History

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

  • [2024-09-09 12:17:22]
  • 评测
  • [2024-09-09 12:17:22]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;

const int N = 5e3 + 5;

struct Node{
  int ax, ay, bx, by;
}s[N];

int n, a, b;
bitset<N> dp[2][N], su[N], g[N];

int main(){
  cin >> n >> a >> b;
  su[0][0] = 1;
  for(int i = 1; i <= n; i++){
    cin >> s[i].ax >> s[i].ay >> s[i].bx >> s[i].by;
    su[i] = su[i - 1];
    su[i][i] = 1;
  }
  for(int i = n; i >= 0; i--){
    g[i] = g[i + 1];
    g[i][i] = 1;
  }
  for(int i = 0; i <= n; i++) dp[0][i].reset(), dp[1][i].reset();
  dp[1][0][0] = 1;
  for(int i = 0; i < n; i++){
    for(int j = 0; j <= i + 1; j++){
      dp[0][j].reset();
      dp[0][j] |= dp[1][j];
      dp[1][j].reset();
    }
    for(int j = 0; j <= i; j++){
      dp[1][j] |= dp[0][j];
      int na = a + j;
      //s[i].bx - b + j <= x <= s[i].by - b + j
      if(na >= s[i + 1].ax && na <= s[i + 1].ay){
        long long l = s[i + 1].bx - b + j, r = s[i + 1].by - b + j;
        if(l > n) continue;
        if(l > r) continue;
        r = min(r, n);
        dp[1][j] |= ((dp[0][j] & g[l] & su[r]) << 1);
        dp[1][j + 1] |= ((dp[0][j] & g[l] & su[r]) << 1);
      }
    }
  }
  int ans = 0;
  for(int i = 0; i <= n; i++){
    for(int k = i; k <= n; k++){
      if(dp[1][i][k]) ans = max(ans, k);
    }
  }
  cout << ans;
  return 0;
}

详细

answer.code: In function ‘int main()’:
answer.code:42:16: error: no matching function for call to ‘min(long long int&, int&)’
   42 |         r = min(r, n);
      |             ~~~^~~~~~
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:233:5: note: candidate: ‘template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)’
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
answer.code:42:16: note:   deduced conflicting types for parameter ‘const _Tp’ (‘long long int’ and ‘int’)
   42 |         r = min(r, n);
      |             ~~~^~~~~~
/usr/include/c++/13/bits/stl_algobase.h:281:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)’
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:281:5: note:   template argument deduction/substitution failed:
answer.code:42:16: note:   deduced conflicting types for parameter ‘const _Tp’ (‘long long int’ and ‘int’)
   42 |         r = min(r, n);
      |             ~~~^~~~~~
In file included from /usr/include/c++/13/algorithm:61:
/usr/include/c++/13/bits/stl_algo.h:5775:5: note: candidate: ‘template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)’
 5775 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5775:5: note:   template argument deduction/substitution failed:
answer.code:42:16: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘long long int’
   42 |         r = min(r, n);
      |             ~~~^~~~~~
/usr/include/c++/13/bits/stl_algo.h:5785:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)’
 5785 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5785:5: note:   template argument deduction/substitution failed:
answer.code:42:16: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘long long int’
   42 |         r = min(r, n);
      |             ~~~^~~~~~