QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#243935#7687. Randias Permutation Taskucup-team2432#Compile Error//C++201.5kb2023-11-08 19:25:552023-11-08 19:25:55

Judging History

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

  • [2023-11-08 19:25:55]
  • 评测
  • [2023-11-08 19:25:55]
  • 提交

answer

#include<bits/stdc++.h>

using LL = long long;
const LL inf = 1e9;
const LL P = 99824353;
LL K = 1;

void init(){
	std::mt19937 rnd(std::random_device{}());
	K = std::max(rnd() % P,10ll);
}

LL hash(const std::vector<int> &vec) {
	LL res = 0,unit = 1;
	for (auto x : vec) {
		res = (res + unit * x) % P;
		unit = unit * K % P;
	}
	return res;
}

void solve() {
	int n,m;std::cin >> n >> m;
	std::vector pmt(m,std::vector<int>(n));
	for (int i = 0; i < m; ++i) {
		for (int j = 0; j < n; ++j) {
			std::cin >> pmt[i][j];
		}
	}
	std::sort(pmt.begin(),pmt.end());
	m = std::unique(pmt.begin(),pmt.end()) - pmt.begin();
	std::vector<int> res(n);
	std::map<LL,int> mp;
	for (int s = 1; s < (1 << m); ++s) {
		res[0] = 0;
		for (int i = 0; i < m; ++i) {
			int biti = 1 << i;
			if (biti & s) {
				if (res[0] == 0) {
					for (int j = 0; j < n; ++j) {
						res[j] = pmt[i][j];
					}
				} else {
					for (int j = 0; j < n; ++j) {
						res[j] = pmt[i][res[j] - 1];
					}
				}
			}
		}
		LL hsh = hash(res);
		mp[hsh] = 1;
	}
	std::cout << mp.size();

}

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(nullptr);

//    clock_t st = clock();
//    std::cout << std::fixed << std::setprecision(12);

//    freopen("test.in", "r", stdin);
//    freopen("test.out", "w", stdout);

	init();

	int T = 1;
//	std::cin >> T;
	while (T --) {
		solve();
	}

//    std::cout << (double)(clock()-st)/CLOCKS_PER_SEC;

	return 0;
}

Details

answer.code: In function ‘void init()’:
answer.code:10:21: error: no matching function for call to ‘max(long long unsigned int, long long int)’
   10 |         K = std::max(rnd() % P,10ll);
      |             ~~~~~~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from answer.code:1:
/usr/include/c++/11/bits/stl_algobase.h:254:5: note: candidate: ‘template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)’
  254 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/11/bits/stl_algobase.h:254:5: note:   template argument deduction/substitution failed:
answer.code:10:21: note:   deduced conflicting types for parameter ‘const _Tp’ (‘long long unsigned int’ and ‘long long int’)
   10 |         K = std::max(rnd() % P,10ll);
      |             ~~~~~~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from answer.code:1:
/usr/include/c++/11/bits/stl_algobase.h:300:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’
  300 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/11/bits/stl_algobase.h:300:5: note:   template argument deduction/substitution failed:
answer.code:10:21: note:   deduced conflicting types for parameter ‘const _Tp’ (‘long long unsigned int’ and ‘long long int’)
   10 |         K = std::max(rnd() % P,10ll);
      |             ~~~~~~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from answer.code:1:
/usr/include/c++/11/bits/stl_algo.h:3461:5: note: candidate: ‘template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)’
 3461 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3461:5: note:   template argument deduction/substitution failed:
answer.code:10:21: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘long long unsigned int’
   10 |         K = std::max(rnd() % P,10ll);
      |             ~~~~~~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from answer.code:1:
/usr/include/c++/11/bits/stl_algo.h:3467:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)’
 3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3467:5: note:   template argument deduction/substitution failed:
answer.code:10:21: note:   mismatched types ‘std::initializer_list<_Tp>’ and ‘long long unsigned int’
   10 |         K = std::max(rnd() % P,10ll);
      |             ~~~~~~~~^~~~~~~~~~~~~~~~