QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#61709 | #1817. AND Permutation | Booksnow | WA | 1ms | 5512kb | C++14 | 1.1kb | 2022-11-14 16:53:53 | 2022-11-14 16:53:56 |
Judging History
answer
#include <bits/stdc++.h>
#define st first
#define nd second
#define db double
#define re register
#define pb push_back
#define mk make_pair
#define int long long
#define ldb long double
#define pii pair<int, int>
#define ull unsigned long long
#define mst(a, b) memset(a, b, sizeof(a))
using namespace std;
const int N = 3e5, INF = 1e15;
inline int read()
{
int s = 0, w = 1;
char ch = getchar();
while(ch < '0' || ch > '9') { if(ch == '-') w *= -1; ch = getchar(); }
while(ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar();
return s * w;
}
int n;
int a[N], b[N];
unordered_map<int, int> mp;
signed main()
{
cout << (4402408632320 & 9574552625479680) << "\n";
n = read();
for(re int i = 1; i <= n; i++) a[i] = read();
for(re int i = 1; i <= n; i++) b[i] = a[i], mp[b[i]] = i;
for(re int t = 59; t >= 0; t--){
for(re int i = 1; i <= n; i++){
assert(((a[i] & b[i]) >> (t + 1)) == 0);
if(a[i] >> t & 1){
int p = mp[b[i] ^ (1 << t)];
swap(b[i], b[p]), mp[b[i]] = i, mp[b[p]] = p;
}
}
}
for(re int i = 1; i <= n; i++) printf("%lld\n", b[i]);
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 5512kb
input:
6 0 1 4 5 2 6
output:
4402341478400 6 4 2 0 5 1
result:
wrong answer Output value not an unused input value.