QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#95997#6308. MagiczqsCompile Error//C++141.2kb2023-04-12 20:10:392023-04-12 20:10:41

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-12 20:10:41]
  • 评测
  • [2023-04-12 20:10:39]
  • 提交

answer

#include <cstdio>
#include <bitset>
#include <cstring>

inline int max(const int x, const int y) {return x > y ? x : y;}
std::bitset<5005> G[5005], vis, tmp;
int l[5005], r[5005], q[5005], lnk[5005], pre[5005], pv[5005], idl[10005], idr[10005], hd, tl;
bool isr[10005];

int main() {
	int n; scanf("%d", &n);
	for (int i = 1; i <= n; ++ i) scanf("%d%d", l + i, r + i), isr[r[i]] = true;
	for (int i = 1, j = 0, k = 0; i <= 2 * n; ++ i)
		if (!isr[i]) idl[i] = ++ j;
		else idr[i] = ++ k;
	for (int i = 1; i <= n; ++ i)
	for (int j = 1; j <= n; ++ j) if (i != j && l[i] < l[j] && l[j] < r[i] && r[i] < r[j]) G[idr[r[i]]].set(idl[l[j]]);
	for(int i=1;i<=n;++i){
		for(int j:G[i])printf("%d -> %d\n",i,j);
	}
	int ans = 2 * n;
	for (int i = 1; i <= n; ++ i) {
		memset(pre, 0, sizeof pre);
		vis.set(), q[hd = tl = 1] = i;
		int p = 0;
		while (hd <= tl) {
			int u = q[hd ++];
			tmp = G[u] & vis;
			for (int i = tmp._Find_first(); i <= n; i = tmp._Find_next(i))
				if (!lnk[i]) {lnk[i] = p = u; break;}
				else q[++ tl] = lnk[i], pre[lnk[i]] = u, pv[lnk[i]] = i, vis.flip(i);
		}
		if (p) {
			-- ans;
			for (int j = p; j != i; j = pre[j]) lnk[pv[j]] = pre[j];
		}
	}
	printf("%d", ans);
	return 0;
}

Details

answer.code: In function ‘int main()’:
answer.code:19:30: error: no matching function for call to ‘begin(std::bitset<5005>&)’
   19 |                 for(int j:G[i])printf("%d -> %d\n",i,j);
      |                              ^
In file included from /usr/include/c++/11/bits/range_access.h:36,
                 from /usr/include/c++/11/string:54,
                 from /usr/include/c++/11/bitset:47,
                 from answer.code:2:
/usr/include/c++/11/initializer_list:90:5: note: candidate: ‘template<class _Tp> constexpr const _Tp* std::begin(std::initializer_list<_Tp>)’
   90 |     begin(initializer_list<_Tp> __ils) noexcept
      |     ^~~~~
/usr/include/c++/11/initializer_list:90:5: note:   template argument deduction/substitution failed:
answer.code:19:30: note:   ‘std::bitset<5005>’ is not derived from ‘std::initializer_list<_Tp>’
   19 |                 for(int j:G[i])printf("%d -> %d\n",i,j);
      |                              ^
In file included from /usr/include/c++/11/string:54,
                 from /usr/include/c++/11/bitset:47,
                 from answer.code:2:
/usr/include/c++/11/bits/range_access.h:51:5: note: candidate: ‘template<class _Container> decltype (__cont.begin()) std::begin(_Container&)’
   51 |     begin(_Container& __cont) -> decltype(__cont.begin())
      |     ^~~~~
/usr/include/c++/11/bits/range_access.h:51:5: note:   template argument deduction/substitution failed:
/usr/include/c++/11/bits/range_access.h: In substitution of ‘template<class _Container> decltype (__cont.begin()) std::begin(_Container&) [with _Container = std::bitset<5005>]’:
answer.code:19:16:   required from here
/usr/include/c++/11/bits/range_access.h:51:50: error: ‘class std::bitset<5005>’ has no member named ‘begin’
   51 |     begin(_Container& __cont) -> decltype(__cont.begin())
      |                                           ~~~~~~~^~~~~
/usr/include/c++/11/bits/range_access.h:61:5: note: candidate: ‘template<class _Container> decltype (__cont.begin()) std::begin(const _Container&)’
   61 |     begin(const _Container& __cont) -> decltype(__cont.begin())
      |     ^~~~~
/usr/include/c++/11/bits/range_access.h:61:5: note:   template argument deduction/substitution failed:
/usr/include/c++/11/bits/range_access.h: In substitution of ‘template<class _Container> decltype (__cont.begin()) std::begin(const _Container&) [with _Container = std::bitset<5005>]’:
answer.code:19:16:   required from here
/usr/include/c++/11/bits/range_access.h:61:56: error: ‘const class std::bitset<5005>’ has no member named ‘begin’
   61 |     begin(const _Container& __cont) -> decltype(__cont.begin())
      |                                                 ~~~~~~~^~~~~
/usr/include/c++/11/bits/range_access.h:90:5: note: candidate: ‘template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::begin(_Tp (&)[_Nm])’
   90 |     begin(_Tp (&__arr)[_Nm]) noexcept
      |     ^~~~~
/usr/include/c++/11/bits/range_access.h:90:5: note:   template argument deduction/substitution failed:
answer.code:19:30: note:   mismatched types ‘_Tp [_Nm]’ and ‘std::bitset<5005>’
   19 |                 for(int j:G[i])printf("%d -> %d\n",i,j);
      |                              ^
In file included from /usr/include/c++/11/string:54,
                 from /usr/include/c++/11/bitset:47,
                 from answer.code:2:
/usr/include/c++/11/bits/range_access.h:107:31: note: candidate: ‘template<class _Tp> _Tp* std::begin(std::valarray<_Tp>&)’
  107 |   template<typename _Tp> _Tp* begin(valarray<_Tp>&);
      |                               ^~~~~
/usr/include/c++/11/bits/range_access.h:107:31: note:   template argument deduction/substitution failed:
answer.code:19:30: note:   ‘std::bitset<5005>’ is not derived from ‘std::valarray<_Tp>’
   19 |                 for(int j:G[i])printf("%d -> %d\n",i,j);
      |                              ^
In file included from /usr/include/c++/11/string:54,
                 from /usr/include/c++/11/bitset:47,
                 from answer.code:2:
/usr/include/c++/11/bits/range_access.h:108:37: note: candidate: ‘template<class _Tp> const _Tp* std::begin(const std::valarray<_Tp>&)’
  108 |   template<typename _Tp> const _Tp* begin(const valarray<_Tp>&);
      |                                     ^~~~~
/usr/include/c++/11/bits/range_access.h:108:37: note:   template argument deduction/substitution failed:
answer.code:19:30: note:   ‘std::bitset<5005>’ is not derived from ‘const std::valarray<_Tp>’
   19 |                 for(int j:G[i])printf("%d -> %d\n",i,j);
      |                              ^
answer.code:19:30: error: no matching function for call to ‘end(std::bitset<5005>&)’
In file included from /usr/include/c++/11/bits/range_access.h:36,
                 from /usr/include/c++/11/string:54,
                 from /usr/include/c++/11/bitset:47,
                 from answer.code:2:
/usr/include/c++/11/initializer_list:101:5: note: candidate: ‘template<class _Tp> constexpr const _Tp* std::end(std::initializer_li...