#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define F first
#define S second
#define pb push_back
#define sz(a) (ll) a.size()
#define all(x) (x).begin(), (x).end()
void Anna( int N, long long X, int K, int P[] ){
set<int> err={};
ll x=X;
for(int i=0; i<K; i++) err.insert(P[i]);
for(int i=0; i<N; i+=3){
int cnt=err.count(i)+err.count(i+1)+err.count(i+2);
if(cnt>=2 || x==0){
Set(i, 0), Set(i+1, 0), Set(i+2, 0);
continue;
}
if(cnt==0){
int mre=x%4;
x/=4;
if(mre==0) Set(i, 1), Set(i+1, 0), Set(i+2, 0);
if(mre==1) Set(i, 0), Set(i+1, 1), Set(i+2, 1);
if(mre==2) Set(i, 1), Set(i+1, 0), Set(i+2, 1);
if(mre==3) Set(i, 1), Set(i+1, 1), Set(i+2, 1);
}
if(cnt==1){
if(x%2){
if(err.count(i+2)) Set(i, 1), Set(i+1, 1), Set(i+2, 0);
else Set(i, 0), Set(i+1, 0), Set(i+2, 1);
x/=2;
} else {
if(err.count(i+1)){
int mre=x%4;
x/=4;
if(mre==0) Set(i, 1), Set(i+1, 0), Set(i+2, 0);
if(mre==2) Set(i, 1), Set(i+1, 0), Set(i+2, 1);
} else {
Set(i, 0), Set(i+1, 1), Set(i+2, 0);
x/=2;
}
}
}
}
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define F first
#define S second
#define pb push_back
#define sz(a) (ll) a.size()
#define all(x) (x).begin(), (x).end()
long long Bruno( int N, int A[] ){
ll ans=0;
stack<int> st;
for(int i=0; i<N; i+=3){
int curr=A[i]*4+A[i+1]*2+A[i+2];
if(curr==0) continue;
if(curr==1) st.push(1);
if(curr==2) st.push(0);
if(curr==3) st.push(1), st.push(0);
if(curr==4) st.push(0), st.push(0);
if(curr==5) st.push(0), st.push(1);
if(curr==6) st.push(1);
if(curr==7) st.push(1), st.push(1);
}
while(!st.empty()){
ans*=2;
ans+=st.top();
st.pop();
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
25 ms |
2772 KB |
Output is correct - L* = 40 |
2 |
Correct |
24 ms |
2752 KB |
Output is correct - L* = 40 |
3 |
Correct |
30 ms |
2772 KB |
Output is correct - L* = 40 |
4 |
Correct |
23 ms |
2668 KB |
Output is correct - L* = 40 |
5 |
Correct |
25 ms |
2752 KB |
Output is correct - L* = 40 |
6 |
Correct |
28 ms |
2752 KB |
Output is correct - L* = 40 |
7 |
Correct |
23 ms |
2780 KB |
Output is correct - L* = 40 |
8 |
Correct |
24 ms |
2776 KB |
Output is correct - L* = 40 |
9 |
Correct |
23 ms |
3260 KB |
Output is correct - L* = 40 |
10 |
Correct |
23 ms |
2864 KB |
Output is correct - L* = 40 |
11 |
Correct |
23 ms |
2776 KB |
Output is correct - L* = 40 |
12 |
Correct |
28 ms |
2780 KB |
Output is correct - L* = 40 |
13 |
Correct |
25 ms |
2780 KB |
Output is correct - L* = 40 |
14 |
Correct |
25 ms |
2848 KB |
Output is correct - L* = 40 |
15 |
Correct |
23 ms |
2852 KB |
Output is correct - L* = 40 |
16 |
Correct |
23 ms |
2776 KB |
Output is correct - L* = 40 |
17 |
Correct |
23 ms |
2780 KB |
Output is correct - L* = 40 |
18 |
Correct |
24 ms |
2888 KB |
Output is correct - L* = 40 |
19 |
Correct |
25 ms |
2784 KB |
Output is correct - L* = 40 |
20 |
Correct |
25 ms |
2776 KB |
Output is correct - L* = 40 |
21 |
Correct |
25 ms |
2716 KB |
Output is correct - L* = 40 |
22 |
Correct |
23 ms |
2748 KB |
Output is correct - L* = 40 |
23 |
Correct |
24 ms |
2760 KB |
Output is correct - L* = 40 |
24 |
Correct |
24 ms |
2780 KB |
Output is correct - L* = 40 |
25 |
Correct |
26 ms |
2748 KB |
Output is correct - L* = 40 |
26 |
Correct |
24 ms |
2772 KB |
Output is correct - L* = 40 |
27 |
Correct |
33 ms |
2976 KB |
Output is correct - L* = 40 |
28 |
Correct |
24 ms |
2772 KB |
Output is correct - L* = 40 |
29 |
Correct |
24 ms |
2640 KB |
Output is correct - L* = 40 |
30 |
Correct |
25 ms |
2776 KB |
Output is correct - L* = 40 |
31 |
Correct |
24 ms |
2772 KB |
Output is correct - L* = 40 |
32 |
Correct |
25 ms |
2868 KB |
Output is correct - L* = 40 |
33 |
Correct |
23 ms |
2768 KB |
Output is correct - L* = 40 |
34 |
Correct |
23 ms |
2748 KB |
Output is correct - L* = 40 |
35 |
Correct |
24 ms |
2820 KB |
Output is correct - L* = 40 |
36 |
Correct |
25 ms |
2776 KB |
Output is correct - L* = 40 |
37 |
Correct |
25 ms |
2776 KB |
Output is correct - L* = 40 |
38 |
Correct |
23 ms |
2776 KB |
Output is correct - L* = 40 |
39 |
Correct |
24 ms |
2864 KB |
Output is correct - L* = 40 |
40 |
Correct |
23 ms |
2776 KB |
Output is correct - L* = 40 |