//#include "Annalib.h"
#include <bits/stdc++.h>
#define L long long
using namespace std;
void Set(int,int);
int a[150];
void Anna(int N,L X,int K,int P[]){
int i;
L bit=1;
for(i=0;i<K;i++)
{
a[P[i]]=-1;
}
for(i=0;i<N;i+=3)
{
//printf("%lld\n",i);
if(X<bit) break;
L sum=a[i]+a[i+1]+a[i+2];
if(sum<=-2) continue;
if(sum==0)
{
switch(X/bit%4){
case 0:
a[i]=a[i+1]=a[i+2]=1;
break;
case 1:
a[i+2]=1;
break;
case 2:
a[i]=a[i+1]=1;
break;
case 3:
a[i+1]=a[i+2]=1;
}
bit<<=2;
}
else
{
if(a[i]==-1)
{
if(X/bit%2==0)
{
a[i+1]=1;
bit<<=1;
}
else
{
if(X/bit%4==1)
{
a[i+2]=1;
}
else
{
a[i+1]=a[i+2]=1;
}
bit<<=2;
}
}
else if(a[i+1]==-1)
{
if(X/bit%2)
{
a[i]=1;
}
else
{
a[i]=a[i+2]=1;
}
bit<<=1;
}
else
{
if(X/bit%2)
{
a[i]=1;
}
else
{
a[i+1]=1;
}
bit<<=1;
}
}
if(X<bit) break;
}
for(i=0;i<N;i++)
{
if(a[i]==1) Set(i,1);
else Set(i,0);
}
}
/*
int p[100010];
int aa[100010];
void Set(int loc,int val){
aa[loc]=val;
}
L con[8]={
0,1,0,3,1,0,2,0
};
L shi[8]{
0,2,1,2,1,1,2,2
};
L Bruno(int N,int A[]){
L ret=0,i,bit=1;
for(i=0;i<N;i+=3)
{
L temp=A[i]*4+A[i+1]*2+A[i+2];
ret+=bit*con[temp];
//printf("%lld %lld\n",bit,temp);
bit<<=shi[temp];
}
return ret;
}
int main()
{
L n,k,x;
scanf("%lld %lld %lld",&n,&k,&x);
for(int i=0;i<k;i++)
{
scanf("%lld",&p[i]);
}
Anna(n,x,k,p);
for(int i=0;i<n;i++)
{
printf("%d ",aa[i]);
}
puts("");
printf("%lld ",Bruno(n,aa));
}
//*/
#include "Brunolib.h"
#include <bits/stdc++.h>
#define L long long
using namespace std;
L con[8]={
0,1,0,3,1,0,2,0
};
L shi[8]{
0,2,1,2,1,1,2,2
};
L Bruno(int N,int A[]){
L ret=0,i,bit=1;
for(i=0;i<N;i+=3)
{
L temp=A[i]*4+A[i+1]*2+A[i+2];
ret+=bit*con[temp];
//printf("%lld %lld\n",bit,temp);
bit<<=shi[temp];
}
return ret;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
44 ms |
3056 KB |
Output isn't correct - L* = 0 |
2 |
Incorrect |
45 ms |
3312 KB |
Output isn't correct - L* = 0 |
3 |
Incorrect |
46 ms |
3480 KB |
Output isn't correct - L* = 0 |
4 |
Incorrect |
48 ms |
3480 KB |
Output isn't correct - L* = 0 |
5 |
Incorrect |
51 ms |
3480 KB |
Output isn't correct - L* = 0 |
6 |
Incorrect |
80 ms |
3888 KB |
Output isn't correct - L* = 0 |
7 |
Incorrect |
65 ms |
3888 KB |
Output isn't correct - L* = 0 |
8 |
Incorrect |
71 ms |
3888 KB |
Output isn't correct - L* = 0 |
9 |
Incorrect |
66 ms |
3888 KB |
Output isn't correct - L* = 0 |
10 |
Incorrect |
67 ms |
3888 KB |
Output isn't correct - L* = 0 |
11 |
Incorrect |
82 ms |
3888 KB |
Output isn't correct - L* = 0 |
12 |
Incorrect |
59 ms |
3888 KB |
Output isn't correct - L* = 0 |
13 |
Incorrect |
55 ms |
3888 KB |
Output isn't correct - L* = 0 |
14 |
Incorrect |
53 ms |
3888 KB |
Output isn't correct - L* = 0 |
15 |
Incorrect |
73 ms |
3888 KB |
Output isn't correct - L* = 0 |
16 |
Incorrect |
58 ms |
3888 KB |
Output isn't correct - L* = 0 |
17 |
Incorrect |
61 ms |
3888 KB |
Output isn't correct - L* = 0 |
18 |
Incorrect |
56 ms |
3888 KB |
Output isn't correct - L* = 0 |
19 |
Incorrect |
62 ms |
3888 KB |
Output isn't correct - L* = 0 |
20 |
Incorrect |
49 ms |
3888 KB |
Output isn't correct - L* = 0 |
21 |
Incorrect |
47 ms |
3888 KB |
Output isn't correct - L* = 0 |
22 |
Incorrect |
49 ms |
3888 KB |
Output isn't correct - L* = 0 |
23 |
Incorrect |
52 ms |
3888 KB |
Output isn't correct - L* = 0 |
24 |
Incorrect |
69 ms |
3888 KB |
Output isn't correct - L* = 0 |
25 |
Incorrect |
48 ms |
3888 KB |
Output isn't correct - L* = 0 |
26 |
Incorrect |
48 ms |
3888 KB |
Output isn't correct - L* = 0 |
27 |
Incorrect |
69 ms |
3888 KB |
Output isn't correct - L* = 0 |
28 |
Incorrect |
50 ms |
3888 KB |
Output isn't correct - L* = 0 |
29 |
Incorrect |
75 ms |
3888 KB |
Output isn't correct - L* = 0 |
30 |
Incorrect |
51 ms |
3888 KB |
Output isn't correct - L* = 0 |
31 |
Incorrect |
55 ms |
3888 KB |
Output isn't correct - L* = 0 |
32 |
Incorrect |
64 ms |
3888 KB |
Output isn't correct - L* = 0 |
33 |
Incorrect |
63 ms |
3888 KB |
Output isn't correct - L* = 0 |
34 |
Incorrect |
66 ms |
3888 KB |
Output isn't correct - L* = 0 |
35 |
Incorrect |
69 ms |
3888 KB |
Output isn't correct - L* = 0 |
36 |
Incorrect |
48 ms |
3888 KB |
Output isn't correct - L* = 0 |
37 |
Incorrect |
49 ms |
3888 KB |
Output isn't correct - L* = 0 |
38 |
Incorrect |
49 ms |
3888 KB |
Output isn't correct - L* = 0 |
39 |
Incorrect |
47 ms |
3888 KB |
Output isn't correct - L* = 0 |
40 |
Incorrect |
73 ms |
3888 KB |
Output isn't correct - L* = 0 |