#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int m = 37;
const int ran[150] = {120, 128, 57, 41, 56, 36, 143, 18, 101, 15, 44, 75, 9, 39, 80, 26, 72, 82, 59, 140, 14, 78, 117, 87, 12, 21, 71, 31, 136, 70, 134, 0, 122, 63, 6, 53, 23, 73, 37, 55, 137, 98, 126, 107, 99, 124, 110, 50, 20, 127, 115, 28, 46, 68, 5, 121, 131, 25, 114, 66, 62, 94, 34, 133, 16, 148, 100, 85, 47, 48, 77, 54, 88, 95, 125, 103, 97, 96, 52, 118, 106, 30, 2, 145, 1, 67, 93, 105, 64, 4, 113, 42, 138, 10, 22, 86, 91, 24, 7, 79, 116, 27, 135, 102, 40, 147, 65, 139, 35, 81, 144, 11, 19, 32, 130, 13, 141, 92, 89, 17, 146, 132, 84, 111, 112, 119, 38, 60, 123, 76, 33, 104, 61, 69, 43, 142, 149, 83, 49, 90, 51, 74, 108, 109, 58, 129, 29, 45, 8, 3};
void Anna(int32_t n, long long x, int32_t k, int32_t p[]){
int pwr[m+1];
pwr[0] = 1;
for (int i=1;i<=m;i++) pwr[i] = pwr[i-1] * 3;
int a[n];
for (int i=0;i<n;i++) a[i] = 1;
for (int i=0;i<k;i++) a[p[i]] = 0;
for (int i=0;i<n;i++) if (a[ran[i^1]]==0) a[ran[i]] = 0;
int cur = 0;
for (int i=0;i<n;i+=2) if (a[ran[i]]) {
int val = x%3;
if (val==0) a[ran[i]] = 0, a[ran[i+1]] = 1;
if (val==1) a[ran[i]] = 1, a[ran[i+1]] = 0;
x /= 3;
}
// for (int i=0;i<n;i++) cout << a[i]; cout << endl;
for (int i=0;i<n;i++) Set(i, (int32_t)a[i]);
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int m = 37;
const int ran[150] = {120, 128, 57, 41, 56, 36, 143, 18, 101, 15, 44, 75, 9, 39, 80, 26, 72, 82, 59, 140, 14, 78, 117, 87, 12, 21, 71, 31, 136, 70, 134, 0, 122, 63, 6, 53, 23, 73, 37, 55, 137, 98, 126, 107, 99, 124, 110, 50, 20, 127, 115, 28, 46, 68, 5, 121, 131, 25, 114, 66, 62, 94, 34, 133, 16, 148, 100, 85, 47, 48, 77, 54, 88, 95, 125, 103, 97, 96, 52, 118, 106, 30, 2, 145, 1, 67, 93, 105, 64, 4, 113, 42, 138, 10, 22, 86, 91, 24, 7, 79, 116, 27, 135, 102, 40, 147, 65, 139, 35, 81, 144, 11, 19, 32, 130, 13, 141, 92, 89, 17, 146, 132, 84, 111, 112, 119, 38, 60, 123, 76, 33, 104, 61, 69, 43, 142, 149, 83, 49, 90, 51, 74, 108, 109, 58, 129, 29, 45, 8, 3};
long long Bruno(int32_t n, int32_t a[]){
int pwr[m+1];
pwr[0] = 1;
for (int i=1;i<=m;i++) pwr[i] = pwr[i-1] * 3;
int x = 0;
int cur = 0;
for (int i=0;i<n && cur<=m;i+=2) if (a[ran[i]]==1 || a[ran[i+1]]==1) {
if (a[ran[i]]==1 && a[ran[i+1]]==0) x += pwr[cur];
if (a[ran[i]]==1 && a[ran[i+1]]==1) x += 2*pwr[cur];
cur++;
}
// cout << x << endl;
return x;
}
Compilation message
Anna.cpp: In function 'void Anna(int32_t, long long int, int32_t, int32_t*)':
Anna.cpp:16:9: warning: unused variable 'cur' [-Wunused-variable]
16 | int cur = 0;
| ^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
20 ms |
2776 KB |
Output is partially correct - L* = 38 |
2 |
Partially correct |
20 ms |
2776 KB |
Output is partially correct - L* = 38 |
3 |
Partially correct |
20 ms |
2792 KB |
Output is partially correct - L* = 39 |
4 |
Partially correct |
20 ms |
2748 KB |
Output is partially correct - L* = 39 |
5 |
Partially correct |
20 ms |
2776 KB |
Output is partially correct - L* = 38 |
6 |
Partially correct |
22 ms |
2776 KB |
Output is partially correct - L* = 37 |
7 |
Partially correct |
20 ms |
2780 KB |
Output is partially correct - L* = 38 |
8 |
Partially correct |
20 ms |
2784 KB |
Output is partially correct - L* = 38 |
9 |
Partially correct |
23 ms |
2776 KB |
Output is partially correct - L* = 39 |
10 |
Partially correct |
27 ms |
2860 KB |
Output is partially correct - L* = 39 |
11 |
Partially correct |
22 ms |
2776 KB |
Output is partially correct - L* = 38 |
12 |
Partially correct |
30 ms |
2792 KB |
Output is partially correct - L* = 38 |
13 |
Partially correct |
20 ms |
2776 KB |
Output is partially correct - L* = 39 |
14 |
Partially correct |
25 ms |
2760 KB |
Output is partially correct - L* = 37 |
15 |
Partially correct |
23 ms |
2768 KB |
Output is partially correct - L* = 38 |
16 |
Partially correct |
23 ms |
2784 KB |
Output is partially correct - L* = 39 |
17 |
Partially correct |
28 ms |
2748 KB |
Output is partially correct - L* = 39 |
18 |
Partially correct |
20 ms |
2804 KB |
Output is partially correct - L* = 38 |
19 |
Partially correct |
22 ms |
2776 KB |
Output is partially correct - L* = 38 |
20 |
Partially correct |
20 ms |
2776 KB |
Output is partially correct - L* = 39 |
21 |
Partially correct |
32 ms |
2772 KB |
Output is partially correct - L* = 39 |
22 |
Partially correct |
24 ms |
2864 KB |
Output is partially correct - L* = 39 |
23 |
Partially correct |
20 ms |
2764 KB |
Output is partially correct - L* = 39 |
24 |
Partially correct |
22 ms |
2776 KB |
Output is partially correct - L* = 39 |
25 |
Partially correct |
20 ms |
2780 KB |
Output is partially correct - L* = 39 |
26 |
Partially correct |
22 ms |
2736 KB |
Output is partially correct - L* = 39 |
27 |
Partially correct |
20 ms |
2784 KB |
Output is partially correct - L* = 39 |
28 |
Partially correct |
20 ms |
2772 KB |
Output is partially correct - L* = 39 |
29 |
Partially correct |
20 ms |
2772 KB |
Output is partially correct - L* = 38 |
30 |
Partially correct |
24 ms |
2752 KB |
Output is partially correct - L* = 39 |
31 |
Partially correct |
22 ms |
2772 KB |
Output is partially correct - L* = 39 |
32 |
Partially correct |
20 ms |
2776 KB |
Output is partially correct - L* = 38 |
33 |
Partially correct |
20 ms |
2772 KB |
Output is partially correct - L* = 38 |
34 |
Partially correct |
20 ms |
2736 KB |
Output is partially correct - L* = 38 |
35 |
Partially correct |
22 ms |
2776 KB |
Output is partially correct - L* = 39 |
36 |
Partially correct |
22 ms |
2860 KB |
Output is partially correct - L* = 39 |
37 |
Partially correct |
20 ms |
2864 KB |
Output is partially correct - L* = 39 |
38 |
Partially correct |
25 ms |
2804 KB |
Output is partially correct - L* = 39 |
39 |
Partially correct |
20 ms |
2764 KB |
Output is partially correct - L* = 38 |
40 |
Partially correct |
23 ms |
2856 KB |
Output is partially correct - L* = 39 |