#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
deque<int> bits;
const int nmax = 205;
int occ[nmax];
vector<int> toset; //two
void myset(int val) { toset.push_back(val); }
void calc(int poz) {
int coef = (occ[poz] << 2) | (occ[poz + 1] << 1) | (occ[poz + 2]);
if(__builtin_popcount(coef) >= 2) {
myset(0);
myset(0);
myset(0);
return;
}
switch(coef) {
case 0b001: {
if(bits[0] == 0) {
//if(bits[1] == 0) // 0
myset(1),
myset(0),
myset(0);
//else // 01
//myset(1),
//myset(1),
//myset(0),
//bits.pop_front();
}
else // 1
myset(0),
myset(1),
myset(0);
break;
}
case 0b010: {
if(bits[0] == 0) // 0
myset(1),
myset(0),
myset(0);
else {
if(bits[1] == 0) // 10
myset(0),
myset(0),
myset(1);
else // 11
myset(1),
myset(0),
myset(1);
bits.pop_front();
}
break;
}
case 0b100: {
if(bits[0] == 0) // 0
myset(0),
myset(1),
myset(1);
else // 1
myset(0),
myset(1),
myset(0);
break;
}
case 0b000: {
int u = (bits[0] << 1) | bits[1];
switch(u) {
case 0b00:
myset(1),
myset(1),
myset(1);
break;
case 0b01:
myset(1),
myset(1),
myset(0);
break;
case 0b10:
myset(0),
myset(0),
myset(1);
break;
case 0b11:
myset(1),
myset(0),
myset(1);
break;
}
bits.pop_front();
}
}
bits.pop_front();
}
void Anna( int n, long long x, int k, int p[] ){
bits.clear();
toset.clear();
for(int i = 59; i >= 0; i--)
bits.push_back((x & (1LL << i)) > 0LL);
for(int i = 0; i <= 300; i++)
bits.push_back(0);
for(int i = 0; i < k; i++)
occ[p[i]] = 1;
for(int i = 0; i < n; i += 3)
calc(i);
for(int i = 0; i < n; i++)
Set(i, toset[i]);
return;
}
//\
1001001010010010001001010010010001001010010010001001010010010001011010101010100\
10010010100100100010010100100100010010100100100010011000000\
10010010100100100010010100100100010010100100100010010100100\
10010110101001011010100101101010010110101001011010101000000\
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
string rez;
void myset(string s) { rez += s;}
vector<int> a;
void calcB(int poz) {
int coef = (a[poz] << 2) | (a[poz + 1] << 1) | a[poz + 2];
switch(coef) {
case 0b111:
myset("00");
break;
case 0b110:
myset("01");
break;
case 0b101:
myset("11");
break;
case 0b011:
myset("0");
break;
case 0b001:
myset("10");
break;
case 0b010:
myset("1");
break;
case 0b100:
myset("0");
break;
case 0b000:
break;
}
return;
}
long long Bruno( int N, int A[] ){
for(int i = 0; i < N; i++)
a.push_back(A[i]);
for(int i = 0; i < N; i += 3)
calcB(i);
long long X = 0;
for(int i = 0; i < 60; i++)
cerr << rez[i];
cerr << '\n';
for(int i = 0; i < 60; i++)
X = (X << 1) + (long long)(rez[i] - '0');
a.clear();
rez = "";
return X;
}
Compilation message
Anna.cpp:112:3: warning: backslash-newline at end of file
112 | //\
|
Anna.cpp:112:1: warning: multi-line comment [-Wcomment]
112 | //\
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
119 ms |
2552 KB |
Output isn't correct - L* = 0 |
2 |
Partially correct |
108 ms |
2692 KB |
Output isn't correct - L* = 0 |
3 |
Partially correct |
108 ms |
2592 KB |
Output isn't correct - L* = 0 |
4 |
Partially correct |
116 ms |
2532 KB |
Output isn't correct - L* = 0 |
5 |
Partially correct |
113 ms |
2580 KB |
Output isn't correct - L* = 0 |
6 |
Partially correct |
101 ms |
2600 KB |
Output isn't correct - L* = 0 |
7 |
Partially correct |
110 ms |
2696 KB |
Output isn't correct - L* = 0 |
8 |
Partially correct |
106 ms |
2536 KB |
Output isn't correct - L* = 0 |
9 |
Partially correct |
108 ms |
2600 KB |
Output isn't correct - L* = 0 |
10 |
Partially correct |
107 ms |
2632 KB |
Output isn't correct - L* = 0 |
11 |
Partially correct |
115 ms |
2904 KB |
Output isn't correct - L* = 0 |
12 |
Partially correct |
101 ms |
2632 KB |
Output isn't correct - L* = 0 |
13 |
Partially correct |
109 ms |
2748 KB |
Output isn't correct - L* = 0 |
14 |
Partially correct |
104 ms |
2556 KB |
Output isn't correct - L* = 0 |
15 |
Partially correct |
105 ms |
2608 KB |
Output isn't correct - L* = 0 |
16 |
Partially correct |
99 ms |
2712 KB |
Output isn't correct - L* = 0 |
17 |
Partially correct |
124 ms |
2576 KB |
Output isn't correct - L* = 0 |
18 |
Partially correct |
107 ms |
2556 KB |
Output isn't correct - L* = 0 |
19 |
Partially correct |
104 ms |
2604 KB |
Output isn't correct - L* = 0 |
20 |
Partially correct |
100 ms |
2552 KB |
Output isn't correct - L* = 0 |
21 |
Partially correct |
106 ms |
2576 KB |
Output isn't correct - L* = 0 |
22 |
Partially correct |
104 ms |
2776 KB |
Output isn't correct - L* = 0 |
23 |
Partially correct |
102 ms |
2588 KB |
Output isn't correct - L* = 0 |
24 |
Partially correct |
102 ms |
2616 KB |
Output isn't correct - L* = 0 |
25 |
Partially correct |
110 ms |
2636 KB |
Output isn't correct - L* = 0 |
26 |
Partially correct |
104 ms |
2632 KB |
Output isn't correct - L* = 0 |
27 |
Partially correct |
100 ms |
2576 KB |
Output isn't correct - L* = 0 |
28 |
Partially correct |
99 ms |
2588 KB |
Output isn't correct - L* = 0 |
29 |
Partially correct |
125 ms |
2544 KB |
Output isn't correct - L* = 0 |
30 |
Partially correct |
113 ms |
2596 KB |
Output isn't correct - L* = 0 |
31 |
Partially correct |
113 ms |
2548 KB |
Output isn't correct - L* = 0 |
32 |
Partially correct |
102 ms |
2572 KB |
Output isn't correct - L* = 0 |
33 |
Partially correct |
111 ms |
2544 KB |
Output isn't correct - L* = 0 |
34 |
Partially correct |
114 ms |
2616 KB |
Output isn't correct - L* = 0 |
35 |
Partially correct |
105 ms |
2604 KB |
Output isn't correct - L* = 0 |
36 |
Partially correct |
105 ms |
2652 KB |
Output isn't correct - L* = 0 |
37 |
Partially correct |
103 ms |
2596 KB |
Output isn't correct - L* = 0 |
38 |
Partially correct |
99 ms |
2544 KB |
Output isn't correct - L* = 0 |
39 |
Partially correct |
104 ms |
2556 KB |
Output isn't correct - L* = 0 |
40 |
Partially correct |
122 ms |
2588 KB |
Output isn't correct - L* = 0 |