QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#372595#1817. AND Permutationchuchu#WA 1ms3524kbC++20906b2024-03-31 16:07:082024-03-31 16:07:09

Judging History

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

  • [2024-03-31 16:07:09]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3524kb
  • [2024-03-31 16:07:08]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define FINISH cerr << "FINISH" << endl;
#define debug(x) cerr << #x << " == " << x << endl
#define el '\n'
#define fir first
#define sec second
typedef long long ll;
typedef pair<int, int> PII;
const int mod = 1000000007;
const int inf = 0x3f3f3f3f;
const int N = 200020;
void solve()
{
	int n;
	cin >> n;
	map<ll, int> mp;
	vector<ll> a(n + 1, 0), b(n + 1, 0);
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		mp[a[i]] = i;
		b[i] = i;
	}
	for (int i = 60; i >= 1; i--) {
		for (int j = 1; j <= n; j++) {
			if (a[j] >> i & 1) {
				swap(b[j], b[mp[a[j] ^ (1ll << i)]]);
			}
		}
	}
	for (int i = 1; i <= n; i++) {
		cout << a[b[i]] << " ";
	}
	cout << endl;
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int T = 1;
	// cin >> T;
	while (T--) {
		solve();
	}
	return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3524kb

input:

6
0
1
4
5
2
6

output:

6 5 2 1 4 0 

result:

wrong answer Bit and of corresponding values not zero.