#include "Annalib.h"
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <vector>
using namespace std;
void Anna( int N, long long X, int K, int P[] ){
vector<int> per(N + 1);
srand(241417941LL);
for (int i = 0; i < (N + 1); ++i) {
per[i] = i;
}
for (int i = 0; i < (N + 1); ++i) {
int pos = i + rand() % (N + 1 - i);
swap(per[i], per[pos]);
}
int bit = 0;
bool validity = true;
vector<bool> bad(N + 1, false);
bad[per[N]] = true;
for (int i = 0; i < K; ++i) {
bad[P[i]] = true;
}
for (int i = 0; i < N; ++i) {
if (validity) {
if (bad[per[i]] || (bad[per[i + 1]] && bit <= 59 && (X & (1LL << bit)))) {
Set(per[i], 0);
validity = true;
} else {
Set(per[i], 1);
validity = false;
}
} else {
if (bit <= 59) {
if (X & (1LL << bit)) {
Set(per[i], 1);
} else {
Set(per[i], 0);
}
bit++;
} else {
Set(per[i], 0);
}
validity = true;
}
}
cerr << "In: " << X << endl;
}
#include "Brunolib.h"
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <vector>
using namespace std;
long long Bruno( int N, int A[] ){
vector<int> per(N + 1);
srand(241417941LL);
for (int i = 0; i < (N + 1); ++i) {
per[i] = i;
}
for (int i = 0; i < (N + 1); ++i) {
int pos = i + rand() % (N + 1 - i);
swap(per[i], per[pos]);
}
bool validity = true;
int bit = 0;
int64_t ans = 0;
for (int i = 0; i < N; ++i) {
if (validity) {
validity = A[per[i]] == 0;
} else {
if (bit <= 59) {
ans |= ((int64_t) A[per[i]]) << bit;
++bit;
}
validity = true;
}
}
cerr << "Out: " << ans << endl;
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
4644 KB |
Wrong Answer [1] |
2 |
Incorrect |
0 ms |
4644 KB |
Wrong Answer [1] |
3 |
Incorrect |
0 ms |
4644 KB |
Wrong Answer [1] |
4 |
Incorrect |
0 ms |
4644 KB |
Wrong Answer [1] |
5 |
Incorrect |
0 ms |
4644 KB |
Wrong Answer [1] |
6 |
Incorrect |
0 ms |
4644 KB |
Wrong Answer [1] |
7 |
Incorrect |
0 ms |
4644 KB |
Wrong Answer [1] |
8 |
Incorrect |
0 ms |
4644 KB |
Wrong Answer [1] |
9 |
Incorrect |
0 ms |
4644 KB |
Wrong Answer [1] |
10 |
Incorrect |
0 ms |
4644 KB |
Wrong Answer [1] |
11 |
Incorrect |
0 ms |
4644 KB |
Wrong Answer [1] |
12 |
Incorrect |
0 ms |
4644 KB |
Wrong Answer [1] |
13 |
Incorrect |
0 ms |
4644 KB |
Wrong Answer [1] |
14 |
Incorrect |
0 ms |
4644 KB |
Wrong Answer [1] |
15 |
Incorrect |
0 ms |
4644 KB |
Wrong Answer [1] |
16 |
Incorrect |
0 ms |
4644 KB |
Wrong Answer [1] |
17 |
Incorrect |
0 ms |
4644 KB |
Wrong Answer [1] |
18 |
Incorrect |
0 ms |
4644 KB |
Wrong Answer [1] |
19 |
Incorrect |
0 ms |
4644 KB |
Wrong Answer [1] |
20 |
Incorrect |
0 ms |
4644 KB |
Wrong Answer [1] |
21 |
Incorrect |
0 ms |
4644 KB |
Wrong Answer [1] |
22 |
Incorrect |
0 ms |
4644 KB |
Wrong Answer [1] |
23 |
Incorrect |
0 ms |
4644 KB |
Wrong Answer [1] |
24 |
Incorrect |
0 ms |
4644 KB |
Wrong Answer [1] |
25 |
Incorrect |
0 ms |
4644 KB |
Wrong Answer [1] |
26 |
Incorrect |
0 ms |
4644 KB |
Wrong Answer [1] |
27 |
Incorrect |
0 ms |
4644 KB |
Wrong Answer [1] |
28 |
Incorrect |
0 ms |
4644 KB |
Wrong Answer [1] |
29 |
Incorrect |
0 ms |
4644 KB |
Wrong Answer [1] |
30 |
Incorrect |
0 ms |
4644 KB |
Wrong Answer [1] |
31 |
Incorrect |
0 ms |
4644 KB |
Wrong Answer [1] |
32 |
Incorrect |
0 ms |
4644 KB |
Wrong Answer [1] |
33 |
Incorrect |
0 ms |
4644 KB |
Wrong Answer [1] |
34 |
Incorrect |
0 ms |
4644 KB |
Wrong Answer [1] |
35 |
Incorrect |
0 ms |
4644 KB |
Wrong Answer [1] |
36 |
Incorrect |
0 ms |
4644 KB |
Wrong Answer [1] |
37 |
Incorrect |
0 ms |
4644 KB |
Wrong Answer [1] |
38 |
Incorrect |
0 ms |
4644 KB |
Wrong Answer [1] |
39 |
Incorrect |
0 ms |
4644 KB |
Wrong Answer [1] |
40 |
Incorrect |
0 ms |
4644 KB |
Wrong Answer [1] |