#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 set3(int id, int a, int b, int c){
Set(id, a);
Set(id+1, b);
Set(id+2, c);
}
void Anna( int N, long long X, int K, int P[] ){
ll curr=X;
set<int> er;
for(int i=0; i<K; i++) er.insert(P[i]);
for(int i=0; i<N; i+=3){
if(er.count(i)+er.count(i+1)+er.count(i+2)>=2 || curr==0){
set3(i, 0, 0, 0); //0->
continue;
}
if(!(er.count(i) || er.count(i+1) || er.count(i+2))){
if(curr%4==0) set3(i, 1, 0, 0); //4->00
if(curr%4==1) set3(i, 1, 1, 0); //5->10
if(curr%4==2) set3(i, 1, 0, 1); //6->01
if(curr%4==3) set3(i, 1, 1, 1); //7->11
curr/=4;
continue;
}
if(curr%2){
if(er.count(i+2)) set3(i, 0, 1, 1); //3->1
else set3(i, 0, 0, 1); //1->1
curr/=2;
} else {
if(er.count(i+1)){
if(curr%4==0) set3(i, 1, 0, 0); //4->00
if(curr%4==2) set3(i, 1, 0, 1); //5->10
curr/=4;
} else {
set3(i, 0, 1, 0); //2->0
curr/=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[] ){
stack<int> st;
ll ans=0;
for(int i=0; i<N; i+=3){
int nw=A[i]*4+A[i+1]*2+A[i+2];
st.push(nw);
}
while(!st.empty()){
int nw=st.top();
st.pop();
if(nw==0) continue;
if(nw==1) ans=ans*2+1;
if(nw==2) ans=ans*2;
if(nw==3) ans=ans*2+1;
if(nw==4) ans=ans*4;
if(nw==5) ans=ans*4+2;
if(nw==6) ans=ans*4+1;
if(nw==7) ans=ans*4+3;
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
24 ms |
2752 KB |
Output isn't correct - L* = 0 |
2 |
Partially correct |
26 ms |
2752 KB |
Output isn't correct - L* = 0 |
3 |
Partially correct |
24 ms |
2768 KB |
Output isn't correct - L* = 0 |
4 |
Partially correct |
24 ms |
2776 KB |
Output isn't correct - L* = 0 |
5 |
Partially correct |
23 ms |
2784 KB |
Output isn't correct - L* = 0 |
6 |
Partially correct |
23 ms |
2748 KB |
Output isn't correct - L* = 0 |
7 |
Partially correct |
25 ms |
2776 KB |
Output isn't correct - L* = 0 |
8 |
Partially correct |
25 ms |
2784 KB |
Output isn't correct - L* = 0 |
9 |
Partially correct |
23 ms |
2776 KB |
Output isn't correct - L* = 0 |
10 |
Partially correct |
23 ms |
2792 KB |
Output isn't correct - L* = 0 |
11 |
Partially correct |
24 ms |
2664 KB |
Output isn't correct - L* = 0 |
12 |
Partially correct |
23 ms |
2752 KB |
Output isn't correct - L* = 0 |
13 |
Partially correct |
27 ms |
2676 KB |
Output isn't correct - L* = 0 |
14 |
Partially correct |
23 ms |
2780 KB |
Output isn't correct - L* = 0 |
15 |
Partially correct |
23 ms |
2772 KB |
Output isn't correct - L* = 0 |
16 |
Partially correct |
24 ms |
2820 KB |
Output isn't correct - L* = 0 |
17 |
Partially correct |
23 ms |
2756 KB |
Output isn't correct - L* = 0 |
18 |
Partially correct |
23 ms |
2720 KB |
Output isn't correct - L* = 0 |
19 |
Partially correct |
24 ms |
2652 KB |
Output isn't correct - L* = 0 |
20 |
Partially correct |
24 ms |
2776 KB |
Output isn't correct - L* = 0 |
21 |
Partially correct |
24 ms |
2856 KB |
Output isn't correct - L* = 0 |
22 |
Partially correct |
22 ms |
2740 KB |
Output isn't correct - L* = 0 |
23 |
Partially correct |
23 ms |
2824 KB |
Output isn't correct - L* = 0 |
24 |
Partially correct |
23 ms |
2780 KB |
Output isn't correct - L* = 0 |
25 |
Partially correct |
23 ms |
2776 KB |
Output isn't correct - L* = 0 |
26 |
Partially correct |
26 ms |
2776 KB |
Output isn't correct - L* = 0 |
27 |
Partially correct |
25 ms |
2752 KB |
Output isn't correct - L* = 0 |
28 |
Partially correct |
23 ms |
2692 KB |
Output isn't correct - L* = 0 |
29 |
Partially correct |
24 ms |
2748 KB |
Output isn't correct - L* = 0 |
30 |
Partially correct |
28 ms |
2840 KB |
Output isn't correct - L* = 0 |
31 |
Partially correct |
24 ms |
2684 KB |
Output isn't correct - L* = 0 |
32 |
Partially correct |
24 ms |
2748 KB |
Output isn't correct - L* = 0 |
33 |
Partially correct |
24 ms |
2748 KB |
Output isn't correct - L* = 0 |
34 |
Partially correct |
34 ms |
2768 KB |
Output isn't correct - L* = 0 |
35 |
Partially correct |
39 ms |
2940 KB |
Output isn't correct - L* = 0 |
36 |
Partially correct |
23 ms |
2752 KB |
Output isn't correct - L* = 0 |
37 |
Partially correct |
24 ms |
2772 KB |
Output isn't correct - L* = 0 |
38 |
Partially correct |
26 ms |
2768 KB |
Output isn't correct - L* = 0 |
39 |
Partially correct |
33 ms |
2848 KB |
Output isn't correct - L* = 0 |
40 |
Partially correct |
24 ms |
2852 KB |
Output isn't correct - L* = 0 |