QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#61709#1817. AND PermutationBooksnowWA 1ms5512kbC++141.1kb2022-11-14 16:53:532022-11-14 16:53:56

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-11-14 16:53:56]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5512kb
  • [2022-11-14 16:53:53]
  • 提交

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;
}

Details

Tip: Click on the bar to expand more detailed information

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.