QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#577521#9310. Permutation Counting 4zjhhhzjCompile Error//C++17472b2024-09-20 12:20:282024-09-20 12:20:28

Judging History

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

  • [2024-09-20 12:20:28]
  • 评测
  • [2024-09-20 12:20:28]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod (1000000007)
#define PII pair<int,int>
#define F first
#define S second
#define N 200005
ll n,m,a[N];
void solve() {
	cin>>n;
	int l,r,ns=0;
	for(int i=1;i<=n;i++){
		cin>>l>>r;
		if(n>=l&&n<=r)ns++;
	}
	cout<<ns&1<<'\n';
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	int _ = 1;
	cin >> _;
	while (_--) {
		solve();
	}
	return 0;
}
/*
*/

Details

answer.code: In function ‘void solve()’:
answer.code:17:17: error: no match for ‘operator&’ (operand types are ‘std::basic_ostream<char>’ and ‘int’)
   17 |         cout<<ns&1<<'\n';
      |         ~~~~~~~~^~~~~~~~
      |             |     |
      |             |     int
      |             std::basic_ostream<char>
answer.code:17:17: note: candidate: ‘operator&(int, int)’ (built-in)
   17 |         cout<<ns&1<<'\n';
      |         ~~~~~~~~^~~~~~~~
answer.code:17:17: note:   no known conversion for argument 1 from ‘std::basic_ostream<char>’ to ‘int’
In file included from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:52,
                 from answer.code:1:
/usr/include/c++/13/bitset:1553:5: note: candidate: ‘template<long unsigned int _Nb> std::bitset<_Nb> std::operator&(const bitset<_Nb>&, const bitset<_Nb>&)’
 1553 |     operator&(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT
      |     ^~~~~~~~
/usr/include/c++/13/bitset:1553:5: note:   template argument deduction/substitution failed:
answer.code:17:21: note:   ‘std::basic_ostream<char>’ is not derived from ‘const std::bitset<_Nb>’
   17 |         cout<<ns&1<<'\n';
      |                     ^~~~
In file included from /usr/include/c++/13/valarray:605,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:166:
/usr/include/c++/13/bits/valarray_after.h:411:5: note: candidate: ‘template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)’
  411 |     _DEFINE_EXPR_BINARY_OPERATOR(&, struct std::__bitwise_and)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/valarray_after.h:411:5: note:   template argument deduction/substitution failed:
answer.code:17:21: note:   ‘std::basic_ostream<char>’ is not derived from ‘const std::_Expr<_Dom1, typename _Dom1::value_type>’
   17 |         cout<<ns&1<<'\n';
      |                     ^~~~
/usr/include/c++/13/bits/valarray_after.h:411:5: note: candidate: ‘template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)’
  411 |     _DEFINE_EXPR_BINARY_OPERATOR(&, struct std::__bitwise_and)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/valarray_after.h:411:5: note:   template argument deduction/substitution failed:
answer.code:17:21: note:   ‘std::basic_ostream<char>’ is not derived from ‘const std::_Expr<_Dom1, typename _Dom1::value_type>’
   17 |         cout<<ns&1<<'\n';
      |                     ^~~~
/usr/include/c++/13/bits/valarray_after.h:411:5: note: candidate: ‘template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)’
  411 |     _DEFINE_EXPR_BINARY_OPERATOR(&, struct std::__bitwise_and)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/valarray_after.h:411:5: note:   template argument deduction/substitution failed:
answer.code:17:21: note:   mismatched types ‘const std::_Expr<_Dom1, typename _Dom1::value_type>’ and ‘int’
   17 |         cout<<ns&1<<'\n';
      |                     ^~~~
/usr/include/c++/13/bits/valarray_after.h:411:5: note: candidate: ‘template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)’
  411 |     _DEFINE_EXPR_BINARY_OPERATOR(&, struct std::__bitwise_and)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/valarray_after.h:411:5: note:   template argument deduction/substitution failed:
answer.code:17:21: note:   ‘std::basic_ostream<char>’ is not derived from ‘const std::_Expr<_Dom1, typename _Dom1::value_type>’
   17 |         cout<<ns&1<<'\n';
      |                     ^~~~
/usr/include/c++/13/bits/valarray_after.h:411:5: note: candidate: ‘template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__bitwise_and, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__bitwise_and, typename _Dom1::value_type>::result_type> std::operator&(const valarray<typename _Dom::value_type>&, const _Expr<_Dom1, typename _Dom1::value_type>&)’
  411 |     _DEFINE_EXPR_BINARY_OPERATOR(&, struct std::__bitwise_and)
      |   ...