QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#617096#6308. MagicfryanCompile Error//C++171002b2024-10-06 13:52:232024-10-06 13:52:23

Judging History

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

  • [2024-10-06 13:52:23]
  • 评测
  • [2024-10-06 13:52:23]
  • 提交

answer

#include "bits/stdc++.h"
using namespace std;
#define all(x) begin(x), end(x)
#define sz(x) (int) (x).size()
mt19937 rng(1);

const int mxn = 5e3+5;

int n;
int l[mxn], r[mxn];
bitset<mxn> adj[mxn],used;

int mt[mxn];

bool kuhn(int v) {
	used.reset(v);
	bitset<mxn> nx = adj[v];
	nx &= used;
	for (int i=nx._Find_first(); i < nx.size(); i = nx._Find_next(i)) {
		vis.reset(i);
		if (mt[i]==-1 || kuhn(mt[i])) {
			mt[i] = v;
			return 1;
		}
		nx &= used;
	}
	return 0;
}

signed main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);
	
	cin>>n;
	
	for (int i=0; i<n; i++) {
		cin>>l[i]>>r[i];
		adj[i].reset();
	}
	for (int i=0; i<n; i++) {
		for (int j=0; j<n; j++) {
			if (l[i] < l[j] && r[i] > l[j] && r[i] < r[j])
				adj[j].set(i);
		}
	}
	memset(mt,-1,sizeof(mt));
	for (int v=0; v<n; v++) {
		used.set();
		kuhn(v);
	}
	
	int cnt = 2*n;
	
	for (int i=0; i<n; i++) {
		if (mt[i] != -1) {
			cnt--;
		}
	}
	
	cout<<cnt;
	return 0;
}

Details

answer.code: In function ‘bool kuhn(int)’:
answer.code:20:17: error: ‘vis’ was not declared in this scope
   20 |                 vis.reset(i);
      |                 ^~~