//#pragma GCC optimize("Ofast,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef long long llo;
#define mp make_pair
#define pb push_back
#define a first
#define b second
#define endl '\n'
#include "Annalib.h"
int vis[151];
int ans[151];
/*vector<llo> yy={0,0,0,0,0,0,
0,0,0,0,0,0,
0,0,0,0,0,0,
0,0,0,0,0,0,
0,0,0,0,0,0,
0,0,0,0,0,0,
1,1,1,1,1,1,
1,1,1,1,1,1,
1,1,1,1,1,1,
1,1,1,1,1,1};*/
void Anna( int n, long long x, int k, int pp[] ){
for(int i=0;i<n;i++){
vis[i]=0;
ans[i]=0;
}
for(int i=0;i<k;i++){
vis[pp[i]]=1;
}
vector<int> kk;
for(int i=0;i<n;i++){
if(vis[i]==0){
kk.pb(i);
}
}
int cot=0;
/*llo pp2=0;
for(int i=0;i<60;i++){
if(x&(1LL<<i)){
pp2+=1;
}
else{
}
}*/
llo st=0;
/*if(pp2<30){
llo y=0;
for(int i=0;i<60;i++){
if(x&(1LL<<i)){
pp+=1;
}
else{
y+=(1LL<<i);
}
}
x=y;
st=1;
}*/
while(cot<kk.size()){
int cur=-1;
int la=-1;
for(int i=0;i<n;i++){
ans[i]=0;
}
llo le=x;
for(int i=0;i<n;i++){
if(cur==60){
break;
}
if(i<kk[cot]){
continue;
}
if(vis[i]==0){
if(cur==-1){
if(i%2==st){
ans[i]=1;
cur++;
la=i;
}
continue;
/*if(i%2==0){
ans[i]=1;
cur++;
}*/
continue;
}
/*llo xx=0;
if(cur>=40){
xx=1;
}*/
if(x&(1LL<<cur)){
if((i-la+cur)%2==1){
le-=(1LL<<cur);
ans[i]=1;
cur++;
la=i;
}
}
else{
if((i-la+cur)%2==0){
ans[i]=1;
cur++;
la=i;
}
}
}
}
if(le==0){
break;
}
cot++;
//if(cur==60){
}
for( int i = 0; i < n; i++ ){
Set( i, ans[i] );
}
return;
//}
/*cur=-1;
for(int i=0;i<n;i++){
ans[i]=0;
}
for(int i=0;i<n;i++){
if(cur==60){
break;
}
if(vis[i]==0){
if(cur==-1){
if(i%2==1){
cur++;
ans[i]=1;
}
continue;
}
if(x&(1LL<<cur)){
if(i%2==0){
ans[i]=1;
cur++;
}
}
else{
if(i%2==1){
ans[i]=1;
cur++;
}
}
}
}
for( int i = 0; i < n; i++ ){
Set( i, ans[i] );
}
*/
}
//#pragma GCC optimize("Ofast,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef long long llo;
#define mp make_pair
#define pb push_back
#define a first
#define b second
#define endl '\n'
#include "Brunolib.h"
/*vector<llo> yy2={0,0,0,0,0,0,
0,0,0,0,0,0,
0,0,0,0,0,0,
0,0,0,0,0,0,
0,0,0,0,0,0,
0,0,0,0,0,0,
1,1,1,1,1,1,
1,1,1,1,1,1,
1,1,1,1,1,1,
1,1,1,1,1,1};*/
long long Bruno( int n, int aa[] ){
vector<int> ss;
llo ans=0;
int x=-1;
for(int i=0;i<n;i++){
if(aa[i]==1){
/*if(x==-1){
x=i;
continue;
}*/
ss.pb(i);
}
}
for(int i=1;i<ss.size();i++){
/*llo xx=0;
if(i-1>=40){
xx=1;
}*/
if((ss[i]-ss[i-1]+i-1)%2==1){
// if(ss[0]%2==1){
ans+=(1LL<<(i-1));
//}
//else{
//}
}
}
/*if(ss[0]%2==1){
ans=(1LL<<60)-1-ans;
}*/
return ans;
if(x%2==0){
for(int i=0;i<ss.size();i++){
if((ss[i]%2==1)){
ans+=(1LL<<i);
}
}
}
else{
for(int i=0;i<ss.size();i++){
if((ss[i]%2==0)){
ans+=(1LL<<i);
}
}
}
return ans;
}
//g++ -std=c++14 -O2 -o aa grader.cpp Anna.cpp Bruno.cpp
Compilation message
Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:63:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
63 | while(cot<kk.size()){
| ~~~^~~~~~~~~~
Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:38:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
38 | for(int i=1;i<ss.size();i++){
| ~^~~~~~~~~~
Bruno.cpp:57:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
57 | for(int i=0;i<ss.size();i++){
| ~^~~~~~~~~~
Bruno.cpp:64:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
64 | for(int i=0;i<ss.size();i++){
| ~^~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
47 ms |
2656 KB |
Output is partially correct - L* = 29 |
2 |
Partially correct |
46 ms |
2492 KB |
Output is partially correct - L* = 14 |
3 |
Partially correct |
48 ms |
2492 KB |
Output is partially correct - L* = 28 |
4 |
Partially correct |
47 ms |
2952 KB |
Output is partially correct - L* = 21 |
5 |
Partially correct |
47 ms |
2492 KB |
Output is partially correct - L* = 15 |
6 |
Partially correct |
45 ms |
2492 KB |
Output is partially correct - L* = 25 |
7 |
Partially correct |
46 ms |
2816 KB |
Output is partially correct - L* = 29 |
8 |
Partially correct |
48 ms |
2620 KB |
Output is partially correct - L* = 29 |
9 |
Partially correct |
46 ms |
2752 KB |
Output is partially correct - L* = 20 |
10 |
Partially correct |
46 ms |
2688 KB |
Output is partially correct - L* = 16 |
11 |
Partially correct |
46 ms |
2492 KB |
Output is partially correct - L* = 27 |
12 |
Partially correct |
47 ms |
2688 KB |
Output is partially correct - L* = 23 |
13 |
Partially correct |
45 ms |
2620 KB |
Output is partially correct - L* = 23 |
14 |
Partially correct |
45 ms |
2688 KB |
Output is partially correct - L* = 19 |
15 |
Partially correct |
44 ms |
2884 KB |
Output is partially correct - L* = 32 |
16 |
Partially correct |
46 ms |
2620 KB |
Output is partially correct - L* = 21 |
17 |
Partially correct |
49 ms |
2620 KB |
Output is partially correct - L* = 22 |
18 |
Partially correct |
45 ms |
2620 KB |
Output is partially correct - L* = 29 |
19 |
Partially correct |
48 ms |
2620 KB |
Output is partially correct - L* = 29 |
20 |
Partially correct |
47 ms |
2632 KB |
Output is partially correct - L* = 24 |
21 |
Partially correct |
46 ms |
2688 KB |
Output is partially correct - L* = 29 |
22 |
Partially correct |
47 ms |
2620 KB |
Output is partially correct - L* = 14 |
23 |
Partially correct |
45 ms |
2696 KB |
Output is partially correct - L* = 15 |
24 |
Partially correct |
46 ms |
2492 KB |
Output is partially correct - L* = 28 |
25 |
Partially correct |
45 ms |
2492 KB |
Output is partially correct - L* = 26 |
26 |
Partially correct |
47 ms |
2688 KB |
Output is partially correct - L* = 22 |
27 |
Partially correct |
45 ms |
2492 KB |
Output is partially correct - L* = 21 |
28 |
Partially correct |
45 ms |
2840 KB |
Output is partially correct - L* = 23 |
29 |
Partially correct |
45 ms |
2492 KB |
Output is partially correct - L* = 15 |
30 |
Partially correct |
46 ms |
2620 KB |
Output is partially correct - L* = 28 |
31 |
Partially correct |
48 ms |
2544 KB |
Output is partially correct - L* = 26 |
32 |
Partially correct |
50 ms |
2700 KB |
Output is partially correct - L* = 16 |
33 |
Partially correct |
45 ms |
2492 KB |
Output is partially correct - L* = 22 |
34 |
Partially correct |
46 ms |
2620 KB |
Output is partially correct - L* = 21 |
35 |
Partially correct |
45 ms |
2492 KB |
Output is partially correct - L* = 28 |
36 |
Partially correct |
45 ms |
2688 KB |
Output is partially correct - L* = 20 |
37 |
Partially correct |
46 ms |
2492 KB |
Output is partially correct - L* = 25 |
38 |
Partially correct |
45 ms |
2696 KB |
Output is partially correct - L* = 27 |
39 |
Partially correct |
45 ms |
2688 KB |
Output is partially correct - L* = 19 |
40 |
Partially correct |
46 ms |
2492 KB |
Output is partially correct - L* = 18 |