#include "Annalib.h"
#include<iostream>
#include<stack>
#include<map>
#include<vector>
#include<string>
#include<cassert>
#include<unordered_map>
#include <queue>
#include <cstdint>
#include<cstring>
#include<limits.h>
#include<cmath>
#include<set>
#include<algorithm>
#include <iomanip>
#include<numeric>
#include<bitset>
using namespace std;
#define ll long long
#define f first
#define s second
#define pii pair<int,int>
#define ppii pair<int,pii>
#define vi vector<int>
#define pb push_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define F(n) for(int i=0;i<n;i++)
#define lb lower_bound
#define ub upper_bound
#define fastio ios::sync_with_stdio(false);cin.tie(NULL);
#pragma GCC optimize ("03,unroll-lopps")
void Anna( int N, long long X, int K, int P[] ){
vector<int>can(N,1);
for(int i=0;i<K;i++)can[P[i]]=0;
int cur=0,pos=0;
vector<int>need;
for(int i=0;i<60;i++){
long long x=(X&(1LL<<i));
need.pb(!!x);
}
int cnt=0,last=-1;
for(int j=0;j<N;j++){
if(can[j]==0||cur>=need.size())Set(j,0);
else if(can[j]){
if(need[cur]){
if((j-last-1)%2==0)Set(j,1),cur++,last=j;
else Set(j,0);
}
else{
if((j-last-1)%2==1)Set(j,1),cur++,last=j;
else Set(j,0);
}
}
}
}
/*
1
150 576460752303423487 28
132 31 36 83 10 85 141 105 98 66 134 131 9 20 122 70 111 23 69 45 97 58 121 47 92 33 147 99
*/
#include "Brunolib.h"
#include<iostream>
#include<stack>
#include<map>
#include<vector>
#include<string>
#include<cassert>
#include<unordered_map>
#include <queue>
#include <cstdint>
#include<cstring>
#include<limits.h>
#include<cmath>
#include<set>
#include<algorithm>
#include <iomanip>
#include<numeric>
#include<bitset>
using namespace std;
#define ll long long
#define f first
#define s second
#define pii pair<int,int>
#define ppii pair<int,pii>
#define vi vector<int>
#define pb push_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define F(n) for(int i=0;i<n;i++)
#define lb lower_bound
#define ub upper_bound
#define fastio ios::sync_with_stdio(false);cin.tie(NULL);
#pragma GCC optimize ("03,unroll-lopps")
long long Bruno( int N, int A[] ){
long long ans=0,cur=0,last=-1;
for(int i=0;i<N;i++){
if(A[i]==1){
if((i-last-1)%2==0){
ans+=(1LL<<cur);
}
cur++;
last=i;
}
}
return ans;
}
/*
1
150 588064823 30
133 50 67 111 138 20 28 107 137 70 96 51 80 38 131 61 114 82 66 21 29 60 144 47 139 45 126 76 19 10
*/
Compilation message
Anna.cpp:33:40: warning: bad option '-funroll-lopps' to pragma 'optimize' [-Wpragmas]
33 | #pragma GCC optimize ("03,unroll-lopps")
| ^
Anna.cpp:34:47: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
34 | void Anna( int N, long long X, int K, int P[] ){
| ^
Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:45:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
45 | if(can[j]==0||cur>=need.size())Set(j,0);
| ~~~^~~~~~~~~~~~~
Anna.cpp:37:13: warning: unused variable 'pos' [-Wunused-variable]
37 | int cur=0,pos=0;
| ^~~
Anna.cpp:43:7: warning: unused variable 'cnt' [-Wunused-variable]
43 | int cnt=0,last=-1;
| ^~~
Bruno.cpp:33:40: warning: bad option '-funroll-lopps' to pragma 'optimize' [-Wpragmas]
33 | #pragma GCC optimize ("03,unroll-lopps")
| ^
Bruno.cpp:34:33: warning: bad option '-funroll-lopps' to attribute 'optimize' [-Wattributes]
34 | long long Bruno( int N, int A[] ){
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
23 ms |
2764 KB |
Output is partially correct - L* = 31 |
2 |
Partially correct |
28 ms |
2752 KB |
Output is partially correct - L* = 30 |
3 |
Partially correct |
22 ms |
2780 KB |
Output is partially correct - L* = 30 |
4 |
Partially correct |
22 ms |
2740 KB |
Output is partially correct - L* = 32 |
5 |
Partially correct |
20 ms |
2748 KB |
Output is partially correct - L* = 31 |
6 |
Partially correct |
20 ms |
2848 KB |
Output is partially correct - L* = 28 |
7 |
Partially correct |
24 ms |
2780 KB |
Output is partially correct - L* = 29 |
8 |
Partially correct |
22 ms |
2784 KB |
Output is partially correct - L* = 27 |
9 |
Partially correct |
20 ms |
2776 KB |
Output is partially correct - L* = 30 |
10 |
Partially correct |
24 ms |
2792 KB |
Output is partially correct - L* = 30 |
11 |
Partially correct |
23 ms |
2708 KB |
Output is partially correct - L* = 29 |
12 |
Partially correct |
22 ms |
2784 KB |
Output is partially correct - L* = 33 |
13 |
Partially correct |
20 ms |
2728 KB |
Output is partially correct - L* = 31 |
14 |
Partially correct |
23 ms |
2768 KB |
Output is partially correct - L* = 30 |
15 |
Partially correct |
22 ms |
2772 KB |
Output is partially correct - L* = 36 |
16 |
Partially correct |
25 ms |
2776 KB |
Output is partially correct - L* = 33 |
17 |
Partially correct |
20 ms |
2780 KB |
Output is partially correct - L* = 26 |
18 |
Partially correct |
25 ms |
2772 KB |
Output is partially correct - L* = 32 |
19 |
Partially correct |
22 ms |
2776 KB |
Output is partially correct - L* = 28 |
20 |
Partially correct |
22 ms |
2776 KB |
Output is partially correct - L* = 29 |
21 |
Partially correct |
22 ms |
2864 KB |
Output is partially correct - L* = 30 |
22 |
Partially correct |
22 ms |
2772 KB |
Output is partially correct - L* = 29 |
23 |
Partially correct |
23 ms |
2804 KB |
Output is partially correct - L* = 31 |
24 |
Partially correct |
20 ms |
2660 KB |
Output is partially correct - L* = 32 |
25 |
Partially correct |
20 ms |
2772 KB |
Output is partially correct - L* = 33 |
26 |
Partially correct |
20 ms |
2752 KB |
Output is partially correct - L* = 31 |
27 |
Partially correct |
20 ms |
2776 KB |
Output is partially correct - L* = 32 |
28 |
Partially correct |
23 ms |
2772 KB |
Output is partially correct - L* = 30 |
29 |
Partially correct |
22 ms |
2772 KB |
Output is partially correct - L* = 33 |
30 |
Partially correct |
23 ms |
2832 KB |
Output is partially correct - L* = 30 |
31 |
Partially correct |
22 ms |
2768 KB |
Output is partially correct - L* = 32 |
32 |
Partially correct |
22 ms |
2860 KB |
Output is partially correct - L* = 30 |
33 |
Partially correct |
22 ms |
2844 KB |
Output is partially correct - L* = 35 |
34 |
Partially correct |
27 ms |
2680 KB |
Output is partially correct - L* = 35 |
35 |
Partially correct |
23 ms |
2864 KB |
Output is partially correct - L* = 28 |
36 |
Partially correct |
23 ms |
2776 KB |
Output is partially correct - L* = 27 |
37 |
Partially correct |
22 ms |
2780 KB |
Output is partially correct - L* = 29 |
38 |
Partially correct |
23 ms |
2772 KB |
Output is partially correct - L* = 29 |
39 |
Partially correct |
24 ms |
2728 KB |
Output is partially correct - L* = 35 |
40 |
Partially correct |
23 ms |
2776 KB |
Output is partially correct - L* = 30 |