#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
// 1 ---- > 0
// 2 ---- > 1
// 5 ---- > 1
// 3 ---- > 10
// 4 ---- > 00
// 6 ---- > 01
// 7 ---- > 11
void assign(int idx, int val) {
if (val >= 4) Set(idx, 1), val -= 4; else Set(idx, 0);
if (val >= 2) Set(idx + 1, 1), val -= 2; else Set(idx + 1, 0);
if (val >= 1) Set(idx + 2, 1), val -= 1; else Set(idx + 2, 0);
}
void Anna( int N, long long X, int K, int P[] ){
std::vector <int> bit, fix;
bit = vector <int> (65, 0);
fix = vector <int> (155, 0);
for (int i = 0; i < 60; i++) {
bit[i] = ((1LL<<i)&X ? 1 : 0);
}
for (int i = 0; i < K; i++) {
fix[P[i]] = 1;
}
int cur = 0;
for (int i = 0; i < 150; i+=3) {
int bl = fix[i] + fix[i + 1] + fix[i + 2];
if (bl >= 2) {
assign(i, 0);
continue;
}
if (bl == 0) {
int val = bit[cur] * 2 + bit[cur];
cur += 2;
if (val == 3) {
assign(i, 7); continue;
}
if (val == 0) {
assign(i, 4); continue;
}
if (val == 1) {
assign(i, 6); continue;
}
if (val == 2) {
assign(i, 3); continue;
}
}
assert(bl == 1);
int val = bit[cur];
if (!fix[i + 2] && val == 0) {
cur++; assign(i, 1); continue;
}
if (!fix[i + 1] && val == 1) {
cur++; assign(i, 2); continue;
}
int val1 = bit[cur + 1];
if (val == 0) { // i da i + 1 emp
if (val1 == 0) {
assign(i, 4); cur += 2; continue;
}
if (val1 == 1) {
assign(i, 6); cur += 2; continue;
}
}
// i da i + 2 emp
if (val1 == 0) {
assign(i, 5); cur++; continue;
}
}
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
// 1 ---- > 0
// 2 ---- > 1
// 5 ---- > 1
// 3 ---- > 10
// 4 ---- > 00
// 6 ---- > 01
// 7 ---- > 11
long long Bruno( int N, int A[] ){
string get[10];
get[1] = "0";
get[2] = "1";
get[5] = "1";
get[3] = "10";
get[4] = "00";
get[6] = "01";
get[7] = "11";
string ans = "";
for (int i = 0; i < 150; i += 3) {
int x = A[i] * 4 + A[i + 1] * 2 + A[i + 2];
ans += get[x];
}
long long res = 0;
for (int i = 0; i < ans.size(); i++) {
res += (ans[i] == '1' ? (1LL<<i) : 0);
}
return res;
}
Compilation message
Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:30:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
30 | for (int i = 0; i < ans.size(); i++) {
| ~~^~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
2 |
Runtime error |
1 ms |
452 KB |
Execution killed with signal 6 |
3 |
Runtime error |
1 ms |
448 KB |
Execution killed with signal 6 |
4 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
5 |
Runtime error |
1 ms |
456 KB |
Execution killed with signal 6 |
6 |
Runtime error |
1 ms |
448 KB |
Execution killed with signal 6 |
7 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
8 |
Runtime error |
1 ms |
452 KB |
Execution killed with signal 6 |
9 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
10 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
11 |
Incorrect |
0 ms |
688 KB |
Wrong Answer [4] |
12 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
13 |
Incorrect |
1 ms |
688 KB |
Wrong Answer [4] |
14 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
15 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
16 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
17 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
18 |
Incorrect |
1 ms |
688 KB |
Wrong Answer [4] |
19 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
20 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
21 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
22 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
23 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
24 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
25 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
26 |
Runtime error |
1 ms |
452 KB |
Execution killed with signal 6 |
27 |
Incorrect |
0 ms |
696 KB |
Wrong Answer [4] |
28 |
Runtime error |
1 ms |
448 KB |
Execution killed with signal 6 |
29 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
30 |
Incorrect |
0 ms |
680 KB |
Wrong Answer [4] |
31 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
32 |
Incorrect |
1 ms |
688 KB |
Wrong Answer [4] |
33 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
34 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
35 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
36 |
Incorrect |
1 ms |
672 KB |
Wrong Answer [4] |
37 |
Incorrect |
1 ms |
688 KB |
Wrong Answer [4] |
38 |
Runtime error |
1 ms |
452 KB |
Execution killed with signal 6 |
39 |
Incorrect |
1 ms |
696 KB |
Wrong Answer [4] |
40 |
Incorrect |
1 ms |
648 KB |
Wrong Answer [4] |