#include "Annalib.h"
#include<bits/stdc++.h>
using namespace std;
const long long inf = (long long) 1e18 + 10;
const int inf1 = (int) 1e9 + 10;
#define int long long
#define dbl long double
#define endl '\n'
#define sc second
#define fr first
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()
const int maxn = 180;
int mark[maxn];
void Anna(int32_t N, int X, int32_t K, int32_t P[]) {
int n = N;
for(int i = 0; i < K; i++) {
int p = P[i];
mark[p] = 1;
if(p%2 == 0) {
mark[p+1] = 1;
}
else {
mark[p-1] = 1;
}
}
string s;
//escreve X aqui
for(int i = 0; i < 60; i+= 3) {
int a = ((X&(1LL<<i)) != 0);
int b = ((X&(1LL<<(i+1))) != 0);
int c = ((X&(1LL<<(i+2))) != 0);
cout << (1LL<<i) << " " << a << " " << b << " " << c << endl;
string s1;
if(a == 0 && b == 0 && c == 0) {
s1 = "1010";
}
else if(a == 1 && b == 0 && c == 0) {
s1 = "1011";
}
else {
if(a == 0) s1+= '0';
else s1+= '1';
s1+= '1';
if(b == 0) s1+= '0';
else s1+= '1';
if(c == 0) s1+= '0';
else s1+= '1';
}
s+= s1;
}
string ans;
int id = 0;
for(int i = 0; i < n; i++) {
cout << i << " " << mark[i] << endl;
if(mark[i] || id == s.size()) {
ans+= '0';
}
else {
ans+= s[id++];
}
}
for(int i = 0; i < n; i++) {
if(ans[i] == '0') Set(i,0);
else Set(i,1);
}
}
// int32_t main() {
// ios::sync_with_stdio(false); cin.tie(0);
// freopen("in.in", "r", stdin);
// // freopen("out.out", "w", stdout);
// int32_t N,X,K;
// cin >> N >> X >> K;
// int32_t P[K];
// for(int i = 0; i < K; i++) {
// cin >> P[i];
// }
// Anna(N,X,K,P);
// }
#include "Brunolib.h"
#include<bits/stdc++.h>
using namespace std;
const long long inf = (long long) 1e18 + 10;
const int inf1 = (int) 1e9 + 10;
#define int long long
#define dbl long double
#define endl '\n'
#define sc second
#define fr first
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()
const int maxn = -1;
int Bruno(int32_t N, int32_t A[]) {
int n = N;
string s;
for(int i = 0; i < n; i+=2) {
if(A[i] == 0 && A[i+1] == 0) {
continue;
}
s+= (char) A[i]+'0';
s+= (char) A[i+1]+'0';
}
int x = 0;
for(int i = 0, pt = 0; i < s.size(); pt+= 3, i+= 4) {
string s1;
s1+= s[i];
s1+= s[i+1];
s1+= s[i+2];
s1+= s[i+3];
int a,b,c;
if(s1 == "1010") {
a = 0;
b = 0;
c = 0;
}
else if(s1 == "1011") {
a = 1;
b = 0;
c = 0;
}
else {
if(s1[0] == '0') a = 0;
else a = 1;
if(s1[2] == '0') b = 0;
else b = 1;
if(s1[3] == '0') c = 0;
else c = 1;
}
x+= a*(1LL<<pt);
x+= b*(1LL<<(pt+1));
x+= c*(1LL<<(pt+2));
}
return x;
}
// int32_t main() {
// ios::sync_with_stdio(false); cin.tie(0);
// freopen("in.in", "r", stdin);
// // freopen("out.out", "w", stdout);
// int32_t N; cin >> N;
// int32_t A[N];
// string s; cin >> s;
// for(int i = 0; i < N; i++) {
// if(s[i] == '0') A[i] = 0;
// else A[i] = 1;
// }
// cout << Bruno(N,A) << endl;
// }
Compilation message
Anna.cpp: In function 'void Anna(int32_t, long long int, int32_t, int32_t*)':
Anna.cpp:64:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
64 | if(mark[i] || id == s.size()) {
| ~~~^~~~~~~~~~~
Bruno.cpp: In function 'long long int Bruno(int32_t, int32_t*)':
Bruno.cpp:31:30: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
31 | for(int i = 0, pt = 0; i < s.size(); pt+= 3, i+= 4) {
| ~~^~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
49 ms |
4880 KB |
Execution killed with signal 11 |
2 |
Runtime error |
49 ms |
4852 KB |
Execution killed with signal 11 |
3 |
Runtime error |
47 ms |
4872 KB |
Execution killed with signal 11 |
4 |
Runtime error |
48 ms |
4820 KB |
Execution killed with signal 11 |
5 |
Runtime error |
52 ms |
4816 KB |
Execution killed with signal 11 |
6 |
Runtime error |
50 ms |
4936 KB |
Execution killed with signal 11 |
7 |
Runtime error |
48 ms |
4876 KB |
Execution killed with signal 11 |
8 |
Runtime error |
49 ms |
4876 KB |
Execution killed with signal 11 |
9 |
Runtime error |
49 ms |
4860 KB |
Execution killed with signal 11 |
10 |
Runtime error |
53 ms |
4872 KB |
Execution killed with signal 11 |
11 |
Runtime error |
50 ms |
4808 KB |
Execution killed with signal 11 |
12 |
Runtime error |
49 ms |
4828 KB |
Execution killed with signal 11 |
13 |
Runtime error |
51 ms |
4816 KB |
Execution killed with signal 11 |
14 |
Runtime error |
48 ms |
4968 KB |
Execution killed with signal 11 |
15 |
Runtime error |
48 ms |
4840 KB |
Execution killed with signal 11 |
16 |
Runtime error |
49 ms |
4784 KB |
Execution killed with signal 11 |
17 |
Runtime error |
50 ms |
4856 KB |
Execution killed with signal 11 |
18 |
Runtime error |
49 ms |
4808 KB |
Execution killed with signal 11 |
19 |
Runtime error |
50 ms |
4832 KB |
Execution killed with signal 11 |
20 |
Runtime error |
47 ms |
4896 KB |
Execution killed with signal 11 |
21 |
Runtime error |
49 ms |
4784 KB |
Execution killed with signal 11 |
22 |
Runtime error |
48 ms |
4820 KB |
Execution killed with signal 11 |
23 |
Runtime error |
53 ms |
4852 KB |
Execution killed with signal 11 |
24 |
Runtime error |
47 ms |
4876 KB |
Execution killed with signal 11 |
25 |
Runtime error |
47 ms |
4772 KB |
Execution killed with signal 11 |
26 |
Runtime error |
47 ms |
4980 KB |
Execution killed with signal 11 |
27 |
Runtime error |
49 ms |
4852 KB |
Execution killed with signal 11 |
28 |
Runtime error |
47 ms |
4772 KB |
Execution killed with signal 11 |
29 |
Runtime error |
50 ms |
4812 KB |
Execution killed with signal 11 |
30 |
Runtime error |
49 ms |
4828 KB |
Execution killed with signal 11 |
31 |
Runtime error |
48 ms |
4808 KB |
Execution killed with signal 11 |
32 |
Runtime error |
48 ms |
4912 KB |
Execution killed with signal 11 |
33 |
Runtime error |
49 ms |
4880 KB |
Execution killed with signal 11 |
34 |
Runtime error |
47 ms |
4880 KB |
Execution killed with signal 11 |
35 |
Runtime error |
48 ms |
4824 KB |
Execution killed with signal 11 |
36 |
Runtime error |
48 ms |
4880 KB |
Execution killed with signal 11 |
37 |
Runtime error |
48 ms |
4928 KB |
Execution killed with signal 11 |
38 |
Runtime error |
49 ms |
4932 KB |
Execution killed with signal 11 |
39 |
Runtime error |
48 ms |
4820 KB |
Execution killed with signal 11 |
40 |
Runtime error |
48 ms |
4884 KB |
Execution killed with signal 11 |