#include "Annalib.h"
void Anna( int n, long long x, int k, int p[] ){
int num[65];
int c=0;
int s,e;
while(x!=0){
num[c]=x%2;
x/2;
c++;
}
int cur=0;
for(int i=0;i<k&&cur<c;i++){
if(i==0) s=0;
else s=p[i-1]+1;
e=p[i];
Set(e,0);
if(e-s<1) continue;
if(e-s==1){
if(num[cur]==1)
Set(s,1);
else
Set(s,0);
}
else{
while(e-s>=num[cur]+1&&cur<c){
if(num[cur]==0){
Set(s,1);
Set(s+1,1);
s+=2;
cur++;
}
else if(num[cur]==1){
Set(s,1);
s++;
cur++;
}
}
if(e-s==1)
Set(s,0);
}
}
int now;
if(cur<c){
e++;
now=e;
while(now<n&&cur<c){
if(num[cur]==0){
if(n-now>=2){
Set(now,1);
Set(now+1,1);
now+=2;
cur++;
}
else{
Set(now,0);
break;
}
}
if(num[cur]==1){
Set(now,1);
now++;
cur++;
}
}
}
for(int i=now;i<n;i++)
Set(i,0);
return;
}
#include "Annalib.h"
long long Bruno( int n, int a[] ){
long long ans=0;
long long p=1;
for(int i=0;i<n;i++){
if(a[i]==1){
if(i<n-1){
if(a[i+1]==1){
ans+=0;
p*=2;
i++;
}
else{
ans+=p;
p*=2;
}
}
else{
ans+=p;
p*=2;
}
}
}
return ans;
}
Compilation message
Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:9:10: warning: statement has no effect [-Wunused-value]
x/2;
~^~
Anna.cpp:69:5: warning: 'now' may be used uninitialized in this function [-Wmaybe-uninitialized]
for(int i=now;i<n;i++)
^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2049 ms |
384 KB |
Time limit exceeded |
2 |
Execution timed out |
2041 ms |
256 KB |
Time limit exceeded |
3 |
Execution timed out |
2050 ms |
256 KB |
Time limit exceeded |
4 |
Execution timed out |
2033 ms |
256 KB |
Time limit exceeded |
5 |
Execution timed out |
2052 ms |
256 KB |
Time limit exceeded |
6 |
Execution timed out |
2020 ms |
256 KB |
Time limit exceeded |
7 |
Execution timed out |
2037 ms |
256 KB |
Time limit exceeded |
8 |
Execution timed out |
2045 ms |
256 KB |
Time limit exceeded |
9 |
Execution timed out |
2015 ms |
256 KB |
Time limit exceeded |
10 |
Execution timed out |
2013 ms |
256 KB |
Time limit exceeded |
11 |
Execution timed out |
2070 ms |
256 KB |
Time limit exceeded |
12 |
Execution timed out |
2033 ms |
256 KB |
Time limit exceeded |
13 |
Execution timed out |
2041 ms |
384 KB |
Time limit exceeded |
14 |
Execution timed out |
2051 ms |
256 KB |
Time limit exceeded |
15 |
Execution timed out |
2033 ms |
256 KB |
Time limit exceeded |
16 |
Execution timed out |
2045 ms |
256 KB |
Time limit exceeded |
17 |
Execution timed out |
2052 ms |
256 KB |
Time limit exceeded |
18 |
Execution timed out |
2061 ms |
256 KB |
Time limit exceeded |
19 |
Execution timed out |
2055 ms |
256 KB |
Time limit exceeded |
20 |
Execution timed out |
2043 ms |
256 KB |
Time limit exceeded |
21 |
Execution timed out |
2036 ms |
384 KB |
Time limit exceeded |
22 |
Execution timed out |
2037 ms |
256 KB |
Time limit exceeded |
23 |
Execution timed out |
2049 ms |
256 KB |
Time limit exceeded |
24 |
Execution timed out |
2033 ms |
384 KB |
Time limit exceeded |
25 |
Execution timed out |
2061 ms |
256 KB |
Time limit exceeded |
26 |
Execution timed out |
2039 ms |
256 KB |
Time limit exceeded |
27 |
Execution timed out |
2053 ms |
256 KB |
Time limit exceeded |
28 |
Execution timed out |
2025 ms |
256 KB |
Time limit exceeded |
29 |
Execution timed out |
2054 ms |
256 KB |
Time limit exceeded |
30 |
Execution timed out |
2062 ms |
256 KB |
Time limit exceeded |
31 |
Execution timed out |
2054 ms |
256 KB |
Time limit exceeded |
32 |
Execution timed out |
2051 ms |
256 KB |
Time limit exceeded |
33 |
Execution timed out |
2033 ms |
256 KB |
Time limit exceeded |
34 |
Execution timed out |
2059 ms |
256 KB |
Time limit exceeded |
35 |
Execution timed out |
2064 ms |
256 KB |
Time limit exceeded |
36 |
Execution timed out |
2045 ms |
256 KB |
Time limit exceeded |
37 |
Execution timed out |
2039 ms |
256 KB |
Time limit exceeded |
38 |
Execution timed out |
2054 ms |
256 KB |
Time limit exceeded |
39 |
Execution timed out |
2058 ms |
256 KB |
Time limit exceeded |
40 |
Execution timed out |
2059 ms |
256 KB |
Time limit exceeded |