QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#57782#1277. PermutationxukhCompile Error//C++1.5kb2022-10-22 21:37:062022-10-22 21:37:07

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-10-22 21:37:07]
  • 评测
  • [2022-10-22 21:37:06]
  • 提交

answer

#include<stdio.h>
#include<algorithm>
#include<map>
using namespace std;
typedef unsigned long long ull;
map<ull,pair<long long,ull> > dp,tmp;
int n;
#define mod ((long long)(1e9)+7)
void fen(ull x){
	printf("{");
	for(int i=0;i<n;++i){
		if(((x)>>i)&1){
			printf("%d ",i);
		}
	}
	printf("}");
}
bool check(ull x,ull fx,int add){
	fx=~fx;
	fx&=(1ULL<<n)-1;
	if(add<=n/2){
		fx>>=max(n-add*2-1,0);
	}else{
		x>>=max(add*2-n+1,0);
	}
	return (x&fx)==0;
}
void run(){
	dp.clear();
	tmp.clear();
	dp[0].first=1,dp[0].second=0;
	scanf("%d",&n);
	ull jj=n;
	for(int ww=0;ww!=n;++ww){
		int x;
		scanf("%d",&x);
		if(x==0){
			for(map<ull,pair<int,ull> >::iterator it=dp.begin();it!=dp.end();++it){
				for(x=0;x<n;++x){
					if((it->first>>x)&1){
						continue;
					}
					if(check(it->first,it->second.second,x)){
						(tmp[it->first|(1<<x)].first+=it->second.first)%=mod,tmp[it->first|(1<<x)].second=it->second.second|(1<<(n-x-1));
					}
				}
			}
		}else{
			jj--;
			x--;
			for(map<ull,pair<int,ull> >::iterator it=dp.begin();it!=dp.end();++it){
				if((it->first>>x)&1){
					continue;
				}
				if(check(it->first,it->second.second,x)){
					(tmp[it->first|(1<<x)].first+=it->second.first)%=mod,tmp[it->first|(1<<x)].second=it->second.second|(1<<(n-x-1));
				}
			}
		}
		dp=tmp;
		tmp.clear();
	}
	ull jie=1;
	for(ull i=1;i<=jj;++i){
		jie=(jie*i)%mod;
	}
	printf("%lld\n",(jie-dp[(1<<n)-1].first+mod)%mod);
}
int main(){
	int t;
	scanf("%d",&t);
	while(t--){
		run();
	}
	return 0;
}

详细

answer.code: In function ‘void run()’:
answer.code:38:74: error: conversion from ‘_Rb_tree_iterator<pair<[...],pair<long long int,[...]>>>’ to non-scalar type ‘_Rb_tree_iterator<pair<[...],pair<int,[...]>>>’ requested
   38 |                         for(map<ull,pair<int,ull> >::iterator it=dp.begin();it!=dp.end();++it){
      |                                                                  ~~~~~~~~^~
answer.code:38:79: error: no match for ‘operator!=’ (operand types are ‘std::map<long long unsigned int, std::pair<int, long long unsigned int> >::iterator’ {aka ‘std::_Rb_tree<long long unsigned int, std::pair<const long long unsigned int, std::pair<int, long long unsigned int> >, std::_Select1st<std::pair<const long long unsigned int, std::pair<int, long long unsigned int> > >, std::less<long long unsigned int>, std::allocator<std::pair<const long long unsigned int, std::pair<int, long long unsigned int> > > >::iterator’} and ‘std::map<long long unsigned int, std::pair<long long int, long long unsigned int> >::iterator’ {aka ‘std::_Rb_tree<long long unsigned int, std::pair<const long long unsigned int, std::pair<long long int, long long unsigned int> >, std::_Select1st<std::pair<const long long unsigned int, std::pair<long long int, long long unsigned int> > >, std::less<long long unsigned int>, std::allocator<std::pair<const long long unsigned int, std::pair<long long int, long long unsigned int> > > >::iterator’})
   38 |                         for(map<ull,pair<int,ull> >::iterator it=dp.begin();it!=dp.end();++it){
      |                                                                             ~~^~~~~~~~~~
      |                                                                             |         |
      |                                                                             |         _Rb_tree_iterator<pair<[...],pair<long long int,[...]>>>
      |                                                                             _Rb_tree_iterator<pair<[...],pair<int,[...]>>>
In file included from /usr/include/c++/11/utility:70,
                 from /usr/include/c++/11/algorithm:60,
                 from answer.code:2:
/usr/include/c++/11/bits/stl_pair.h:496:5: note: candidate: ‘template<class _T1, class _T2> constexpr bool std::operator!=(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&)’
  496 |     operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
      |     ^~~~~~~~
/usr/include/c++/11/bits/stl_pair.h:496:5: note:   template argument deduction/substitution failed:
answer.code:38:88: note:   ‘std::map<long long unsigned int, std::pair<int, long long unsigned int> >::iterator’ {aka ‘std::_Rb_tree<long long unsigned int, std::pair<const long long unsigned int, std::pair<int, long long unsigned int> >, std::_Select1st<std::pair<const long long unsigned int, std::pair<int, long long unsigned int> > >, std::less<long long unsigned int>, std::allocator<std::pair<const long long unsigned int, std::pair<int, long long unsigned int> > > >::iterator’} is not derived from ‘const std::pair<_T1, _T2>’
   38 |                         for(map<ull,pair<int,ull> >::iterator it=dp.begin();it!=dp.end();++it){
      |                                                                                        ^
In file included from /usr/include/c++/11/bits/stl_algobase.h:67,
                 from /usr/include/c++/11/algorithm:61,
                 from answer.code:2:
/usr/include/c++/11/bits/stl_iterator.h:428:5: note: candidate: ‘template<class _Iterator> constexpr bool std::operator!=(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&)’
  428 |     operator!=(const reverse_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/11/bits/stl_iterator.h:428:5: note:   template argument deduction/substitution failed:
answer.code:38:88: note:   ‘std::map<long long unsigned int, std::pair<int, long long unsigned int> >::iterator’ {aka ‘std::_Rb_tree<long long unsigned int, std::pair<const long long unsigned int, std::pair<int, long long unsigned int> >, std::_Select1st<std::pair<const long long unsigned int, std::pair<int, long long unsigned int> > >, std::less<long long unsigned int>, std::allocator<std::pair<const long long unsigned int, std::pair<int, long long unsigned int> > > >::iterator’} is not derived from ‘const std::reverse_iterator<_Iterator>’
   38 |                         for(map<ull,pair<int,ull> >::iterator it=dp.begin();it!=dp.end();++it){
      |                                                                                        ^
In file included from /usr/include/c++/11/bits/stl_algobase.h:67,
                 from /usr/include/c++/11/algorithm:61,
                 from answer.code:2:
/usr/include/c++/11/bits/stl_iterator.h:467:5: note: candidate: ‘template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&)’
  467 |     operator!=(const reverse_...