QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#244350#7687. Randias Permutation Taskucup-team2432#WA 0ms3540kbC++201.2kb2023-11-08 23:28:142023-11-08 23:28:15

Judging History

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

  • [2023-11-08 23:28:15]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3540kb
  • [2023-11-08 23:28:14]
  • 提交

answer

#include<bits/stdc++.h>

using LL = long long;
const LL inf = 1e9;
const LL P[2] = {1000000007,1000000009};
const LL K = 7653524;

void solve() {

	std::mt19937 rnd(std::random_device{}());

	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::shuffle(pmt.begin(),pmt.end(),rnd);
	std::map<std::vector<int>,int> mp;
	std::function<void(int,const std::vector<int>&)> dfs = [&](int p,const std::vector<int> &vec) {
		if (!mp.count(vec) || mp[vec] >= p) {
			mp[vec] = p;
			if (p == m) { return; }
			dfs(p+1,vec);
			std::vector<int> now(n);
			for (int i = 0; i < n; ++i) {
				now[i] = vec[pmt[p][i] - 1];
			}
			dfs(p+1,now);
		}
	};
	for (int i = 0; i < m; ++i) {
		dfs(i+1,pmt[i]);
	}
	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);

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

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

	return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3540kb

input:

5 4
1 2 3 4 5
5 1 3 4 2
3 4 1 5 2
5 2 4 1 3

output:

7

result:

wrong answer 1st numbers differ - expected: '8', found: '7'