QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#99119#6308. MagicDrGilbertCompile Error//C++20670b2023-04-21 11:12:372023-04-21 11:12:39

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-21 11:12:39]
  • 评测
  • [2023-04-21 11:12:37]
  • 提交

answer

#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
const int N=5010;
int l[N],r[N],mat[N];
bitset<N> G[N],vis;
bool dfs(int x){
	bitset<N> tmp=vis&G[x];
	for (int v=tmp._Find_first();v<N;v=tmp._Find_next(v)){
		vis[v]=0;if (!mat[v]||dfs(mat[v])) return mat[v]=u;
	}return 0;
}
int main(){
	ios::sync_with_stdio(0);
	cin.tie(nullptr);cout.tie(nullptr);
	int n;cin>>n;
	for (int i=1;i<=n;i++) cin>>l[i]>>r[i];
	for (int i=1;i<=n;i++){
		for (int j=1;j<=n;j++){
			if (l[i]<l[j]&&l[j]<r[i]&&r[i]<r[j]){
				G[j][i]=1;
			}
		}
	}int ans=2*n;
	for (int i=1;i<=n;i++){
		vis.set();ans-=dfs(i);
	}cout<<ans<<endl;return 0;
}

Details

answer.code: In function ‘bool dfs(int)’:
answer.code:10:66: error: ‘u’ was not declared in this scope
   10 |                 vis[v]=0;if (!mat[v]||dfs(mat[v])) return mat[v]=u;
      |                                                                  ^