#include"bits/stdc++.h"
using namespace std;
#define LL long long
#define MP make_pair
#include"Annalib.h"
static vector<int> keta(LL X, int i){
vector<int> re;
while(X > 0){
re.push_back(X%i);
X /= i;
}
return re;
}
static LL make(vector<int> v, int i){
LL re = 0;
for(int j=v.size()-1; j>=0; j--){
re *= i;
re += v[j];
}
return re;
}
//void Set(int pos, int bit)
//N=150
void Anna(int N, long long X, int K, int P[]){
bool canUse[150];
for(int i=0; i<N; i++) canUse[i] = true;
for(int i=0; i<K; i++) canUse[P[i]] = false;
vector<int> tmp = keta(X, 2);
LL now = 0;
for(int i=0; i+2<N; i+=3){
if(now < tmp.size()){
if(canUse[i] && canUse[i+1] && canUse[i+2]){
if(now+1 == tmp.size()){
if(tmp[now] == 0){
Set(i, 0);
Set(i+1, 0);
Set(i+2, 1);
}
if(tmp[now] == 1){
Set(i, 0);
Set(i+1, 1);
Set(i+2, 0);
}
}
else{
if(tmp[now] == 0 && tmp[now+1] == 0){
Set(i, 1);
Set(i+1, 0);
Set(i+2, 0);
}
if(tmp[now] == 0 && tmp[now+1] == 1){
Set(i, 1);
Set(i+1, 1);
Set(i+2, 0);
}
if(tmp[now] == 1 && tmp[now+1] == 0){
Set(i, 0);
Set(i+1, 1);
Set(i+2, 1);
}
if(tmp[now] == 1 && tmp[now+1] == 1){
Set(i, 1);
Set(i+1, 1);
Set(i+2, 1);
}
}
now += 2;
}
else if(canUse[i+1] && canUse[i+2]){
if(tmp[now] == 0){
Set(i, 0);
Set(i+1, 0);
Set(i+2, 1);
}
if(tmp[now] == 1){
Set(i, 0);
Set(i+1, 1);
Set(i+2, 0);
}
now++;
}
else if(canUse[i] && canUse[i+2]){
if(tmp[now] == 0){
Set(i, 0);
Set(i+1, 0);
Set(i+2, 1);
}
if(tmp[now] == 1){
Set(i, 1);
Set(i+1, 0);
Set(i+2, 1);
}
now++;
}
else if(canUse[i] && canUse[i+1]){
if(tmp[now] == 0){
if(now+1 == tmp.size()){
Set(i, 0);
Set(i+1, 0);
Set(i+2, 0);
}
else if(tmp[now+1] == 0){
Set(i, 1);
Set(i+1, 0);
Set(i+2, 0);
now += 2;
}
else if(tmp[now+1] == 1){
Set(i, 1);
Set(i+1, 1);
Set(i+2, 0);
now += 2;
}
}
else if(tmp[now] == 1){
Set(i, 0);
Set(i+1, 1);
Set(i+2, 0);
now++;
}
}
else{
Set(i, 0);
Set(i+1, 0);
Set(i+2, 0);
}
}
else{
Set(i, 0);
Set(i+1, 0);
Set(i+2, 0);
}
}
}
#include"bits/stdc++.h"
using namespace std;
#define LL long long
#define MP make_pair
#include"Brunolib.h"
static vector<int> keta(LL X, int i){
vector<int> re;
while(X > 0){
re.push_back(X%i);
X /= i;
}
return re;
}
static LL make(vector<int> v, int i){
LL re = 0;
for(int j=v.size()-1; j>=0; j--){
re *= i;
re += v[j];
}
return re;
}
long long Bruno(int N, int A[]){
vector<int> ans;
for(int i=0; i+2<N; i+=3){
if(A[i] == 0 && A[i+1] == 0 && A[i+2] == 1){
ans.push_back(0);
}
if(A[i] == 0 && A[i+1] == 1 && A[i+2] == 0){
ans.push_back(1);
}
if(A[i] == 0 && A[i+1] == 1 && A[i+2] == 1){
ans.push_back(1);
ans.push_back(0);
}
if(A[i] == 1 && A[i+1] == 0 && A[i+2] == 0){
ans.push_back(0);
ans.push_back(0);
}
if(A[i] == 1 && A[i+1] == 0 && A[i+2] == 1){
ans.push_back(1);
}
if(A[i] == 1 && A[i+1] == 1 && A[i+2] == 0){
ans.push_back(0);
ans.push_back(1);
}
if(A[i] == 1 && A[i+1] == 1 && A[i+2] == 1){
ans.push_back(1);
ans.push_back(1);
}
}
return make(ans,2);
}
Compilation message
Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:34:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if(now < tmp.size()){
~~~~^~~~~~~~~~~~
Anna.cpp:36:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if(now+1 == tmp.size()){
~~~~~~^~~~~~~~~~~~~
Anna.cpp:100:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if(now+1 == tmp.size()){
~~~~~~^~~~~~~~~~~~~
Anna.cpp: At global scope:
Anna.cpp:16:11: warning: 'long long int make(std::vector<int>, int)' defined but not used [-Wunused-function]
static LL make(vector<int> v, int i){
^~~~
Bruno.cpp:7:20: warning: 'std::vector<int> keta(long long int, int)' defined but not used [-Wunused-function]
static vector<int> keta(LL X, int i){
^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
52 ms |
3056 KB |
Output is correct - L* = 40 |
2 |
Correct |
55 ms |
3016 KB |
Output is correct - L* = 40 |
3 |
Correct |
51 ms |
3072 KB |
Output is correct - L* = 40 |
4 |
Correct |
67 ms |
3072 KB |
Output is correct - L* = 40 |
5 |
Correct |
54 ms |
3056 KB |
Output is correct - L* = 40 |
6 |
Correct |
55 ms |
3072 KB |
Output is correct - L* = 40 |
7 |
Correct |
44 ms |
3056 KB |
Output is correct - L* = 40 |
8 |
Correct |
49 ms |
3056 KB |
Output is correct - L* = 40 |
9 |
Correct |
46 ms |
3000 KB |
Output is correct - L* = 40 |
10 |
Correct |
49 ms |
3000 KB |
Output is correct - L* = 40 |
11 |
Correct |
49 ms |
2816 KB |
Output is correct - L* = 40 |
12 |
Correct |
48 ms |
3072 KB |
Output is correct - L* = 40 |
13 |
Correct |
55 ms |
3056 KB |
Output is correct - L* = 40 |
14 |
Correct |
40 ms |
3072 KB |
Output is correct - L* = 40 |
15 |
Correct |
47 ms |
3072 KB |
Output is correct - L* = 40 |
16 |
Correct |
41 ms |
3056 KB |
Output is correct - L* = 40 |
17 |
Correct |
52 ms |
3056 KB |
Output is correct - L* = 40 |
18 |
Correct |
44 ms |
3056 KB |
Output is correct - L* = 40 |
19 |
Correct |
54 ms |
3072 KB |
Output is correct - L* = 40 |
20 |
Correct |
44 ms |
3056 KB |
Output is correct - L* = 40 |
21 |
Correct |
53 ms |
3000 KB |
Output is correct - L* = 40 |
22 |
Correct |
50 ms |
3056 KB |
Output is correct - L* = 40 |
23 |
Correct |
51 ms |
3056 KB |
Output is correct - L* = 40 |
24 |
Correct |
45 ms |
2800 KB |
Output is correct - L* = 40 |
25 |
Correct |
40 ms |
2800 KB |
Output is correct - L* = 40 |
26 |
Correct |
44 ms |
3072 KB |
Output is correct - L* = 40 |
27 |
Correct |
53 ms |
3056 KB |
Output is correct - L* = 40 |
28 |
Correct |
54 ms |
3072 KB |
Output is correct - L* = 40 |
29 |
Correct |
55 ms |
3056 KB |
Output is correct - L* = 40 |
30 |
Correct |
49 ms |
3056 KB |
Output is correct - L* = 40 |
31 |
Correct |
46 ms |
3000 KB |
Output is correct - L* = 40 |
32 |
Correct |
47 ms |
3072 KB |
Output is correct - L* = 40 |
33 |
Correct |
51 ms |
3056 KB |
Output is correct - L* = 40 |
34 |
Correct |
55 ms |
3072 KB |
Output is correct - L* = 40 |
35 |
Correct |
44 ms |
3072 KB |
Output is correct - L* = 40 |
36 |
Correct |
42 ms |
3072 KB |
Output is correct - L* = 40 |
37 |
Correct |
40 ms |
3056 KB |
Output is correct - L* = 40 |
38 |
Correct |
41 ms |
3072 KB |
Output is correct - L* = 40 |
39 |
Correct |
49 ms |
3000 KB |
Output is correct - L* = 40 |
40 |
Correct |
43 ms |
3072 KB |
Output is correct - L* = 40 |