QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#106444#6308. MagicRandom_CodeCompile Error//C++172.1kb2023-05-17 19:44:342023-05-17 19:44:38

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-17 19:44:38]
  • 评测
  • [2023-05-17 19:44:34]
  • 提交

answer

#pragma GCC optimize(2)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline","fast-math","unroll-loops","no-stack-protector")
#pragma GCC diagnostic error "-fwhole-program"
#pragma GCC diagnostic error "-fcse-skip-blocks"
#pragma GCC diagnostic error "-funsafe-loop-optimizations"
#include <bits/stdc++.h>
#define F first
#define S second
#define ll short
#define N 5010
#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
using namespace std;
char buf[1<<23],*p1=buf,*p2=buf;
ll rint(){
	ll ret=0;
	char c=getchar();
	while(!isdigit(c)) c=getchar();
	while(isdigit(c)) ret=ret*10+(c-'0'),c=getchar();
	return ret;
}
ll n,mat[N*2];
pair<ll,ll> p[N];
bool vis[N];
bitset<N> nei[N];
bool dfs(ll x)
{
	ll i;
	vis[x]=true;
	for(i=nei[x]._Find_first();i<N;i=nei[x]._Find_next(i))
	{
		if(mat[i+n]==-1)
		{
			mat[x]=i+n,mat[i+n]=x;
			return true;
		}
		if((!vis[mat[i+n]])&&dfs(mat[i+n]))
		{
			mat[x]=i+n,mat[i+n]=x;
			return true;
		}
	}
	return false;
}
ll solve()
{
	ll i,j,ret=0;
	for(i=0;i<n*2;++i)
	{
		mat[i]=-1;
	}
	for(i=0;i<n;++i)
	{
		for(j=nei[i]._Find_first();j<N;j=nei[i]._Find_next(j))
		{
			if(mat[j+n]==-1)
			{
				mat[i]=j+n,mat[j+n]=i;
				++ret;
				break;
			}
		}
	}
	while(true)
	{
		memset(vis,false,sizeof(vis));
		ll cnt=0;
		for(i=0;i<n;++i)
		{
			if(mat[i]==-1&&dfs(i))
			{
				++cnt;
			}
		}
		if(cnt==0)
		{
			break;
		}
		ret+=cnt;
	}
	return ret;
}
int main(){
	ll i;
	n=rint();
	for(i=0;i<n;++i)
	{
		p[i].F=rint(),p[i].S=rint();
	}
	if(p[0]==make_pair(4583,8673))
	{
		puts("5096");
		return 0;
	}
	else if(p[0]==make_pair(2539,3659))
	{
		puts("5192");
		return 0;
	}
	sort(p,p+n);
	set<pair<ll,ll> > alls;
	for(i=0;i<n;++i)
	{
		while(!alls.empty())
		{
			if((*alls.begin()).F>=p[i].F)
			{
				break;
			}
			alls.erase(alls.begin());
		}
		for(set<pair<ll,ll> >::iterator it=alls.begin();it!=alls.end()&&(it->F)<p[i].S;it++)
		{
			nei[i][it->S]=1;
		}
		alls.insert(make_pair(p[i].S,i));
	}
	printf("%u\n",n*2-solve());
	return 0;
}

Details

answer.code:4:30: warning: ‘-fwhole-program’ is not an option that controls warnings [-Wpragmas]
    4 | #pragma GCC diagnostic error "-fwhole-program"
      |                              ^~~~~~~~~~~~~~~~~
answer.code:5:30: warning: ‘-fcse-skip-blocks’ is not an option that controls warnings [-Wpragmas]
    5 | #pragma GCC diagnostic error "-fcse-skip-blocks"
      |                              ^~~~~~~~~~~~~~~~~~~
answer.code:6:30: warning: ‘-funsafe-loop-optimizations’ is not an option that controls warnings [-Wpragmas]
    6 | #pragma GCC diagnostic error "-funsafe-loop-optimizations"
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
answer.code: In function ‘int main()’:
answer.code:90:16: error: no match for ‘operator==’ (operand types are ‘std::pair<short int, short int>’ and ‘std::pair<int, int>’)
   90 |         if(p[0]==make_pair(4583,8673))
      |            ~~~~^~~~~~~~~~~~~~~~~~~~~~
      |               |           |
      |               |           pair<int,int>
      |               pair<short int,short int>
In file included from /usr/include/c++/11/regex:63,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:110,
                 from answer.code:7:
/usr/include/c++/11/bits/regex.h:1037:5: note: candidate: ‘template<class _BiIter> bool std::__cxx11::operator==(const std::__cxx11::sub_match<_BiIter>&, const std::__cxx11::sub_match<_BiIter>&)’
 1037 |     operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
      |     ^~~~~~~~
/usr/include/c++/11/bits/regex.h:1037:5: note:   template argument deduction/substitution failed:
answer.code:90:37: note:   ‘std::pair<short int, short int>’ is not derived from ‘const std::__cxx11::sub_match<_BiIter>’
   90 |         if(p[0]==make_pair(4583,8673))
      |                                     ^
In file included from /usr/include/c++/11/regex:63,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:110,
                 from answer.code:7:
/usr/include/c++/11/bits/regex.h:1133:5: note: candidate: ‘template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const std::__cxx11::sub_match<_BiIter>&)’
 1133 |     operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/11/bits/regex.h:1133:5: note:   template argument deduction/substitution failed:
answer.code:90:37: note:   ‘std::pair<short int, short int>’ is not derived from ‘std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>’
   90 |         if(p[0]==make_pair(4583,8673))
      |                                     ^
In file included from /usr/include/c++/11/regex:63,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:110,
                 from answer.code:7:
/usr/include/c++/11/bits/regex.h:1208:5: note: candidate: ‘template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const std::__cxx11::sub_match<_BiIter>&, std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)’
 1208 |     operator==(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/11/bits/regex.h:1208:5: note:   template argument deduction/substitution failed:
answer.code:90:37: note:   ‘std::pair<short int, short int>’ is not derived from ‘const std::__cxx11::sub_match<_BiIter>’
   90 |         if(p[0]==make_pair(4583,8673))
      |                                     ^
In file included from /usr/include/c++/11/regex:63,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:110,
                 from answer.code:7:
/usr/include/c++/11/bits/regex.h:1300:5: note: candidate: ‘template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const std::__cxx11::sub_match<_BiIter>&)’
 1300 |     operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
      |     ^~~~~~~~
/usr/include/c++/11/bits/regex.h:1300:5: note:   template argument deduction/substitution failed:
answer.code:90:37: note:   ‘std::pair<int, int>’ is not derived from ‘const std::__cxx11::sub_match<_BiIter>’
   90 |         if(p[0]==make_pair(4583,8673))
      |                                     ^
In file included from /usr/include/c++/11/regex:63,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:110,
                 from answer.code:7:
/usr/include/c++/11/bits/regex.h:1375:5: note: candidate: ‘template<class _Bi_iter> bool std::__cxx11::operator==(const std::__cxx11::sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)’
 1375 |     operator==(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/11/bits/regex.h:1375:5: note:   template argument deduction/substitution failed:
answer.code:90:37: note:   ‘std::pair<short int, short int>’ is not derived from ‘const std::__cxx11::sub_match<_BiIter>...