#include "Annalib.h"
/*input
3
10 50
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
//order_of_key #of elements less than x
// find_by_order kth element
typedef long long int ll;
#define ld long double
#define pii pair<ll,int>
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
namespace {
int v[155];
int ans[155];
void setv(int i,vector<int> v){
REP(a,3) ans[i*3+a]=v[a];
}
int cnt[155];
bool hv[155];
}
void Anna( int N, long long X, int K, int P[] ){
int cur=0;
REP(i,60){
v[i]=(X>>(i))&1;
}
REP(i,N) cnt[i]=0,hv[i]=0;
REP(i,K){
cnt[P[i]/3]++;
hv[P[i]]=1;
}
REP(i,N/3){
if(!cnt[i]){
int val=v[cur]*2+v[cur+1];
if(val==2){
setv(i,{0,1,1});
}
else{
setv(i,{1,v[cur],v[cur+1]});
}
cur+=2;
}
else if(cnt[i]==1){
if(hv[i*3]){
if(!v[cur]) setv(i,{0,1,0});
else setv(i,{0,0,1});
++cur;
}
else if(hv[i*3+2]){
if(!v[cur]) setv(i,{0,1,0});
else setv(i,{1,1,0});
++cur;
}
else{
if(v[cur]){
setv(i,{0,0,1});
++cur;
}
else{
if(!v[cur+1]) setv(i,{1,0,0});
else setv(i,{1,0,1});
cur+=2;
}
}
}
}
REP(i,N) Set(i,ans[i]);
}
#include "Brunolib.h"
/*input
3
10 50
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
//order_of_key #of elements less than x
// find_by_order kth element
typedef long long int ll;
#define ld long double
#define pii pair<ll,int>
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
namespace {
int len[] = { 0, 1, 1, 2, 2, 2, 1, 2 };
int val[] = { 0, 1, 0, 2, 0, 1, 1, 3 };
}
long long Bruno( int N, int A[] ){
ll ans=0;
vector<int> cur;
REP(i,N/3){
int c=A[i*3]*4+A[i*3+1]*2+A[i*3+2];
if(len[c]==1) cur.pb(val[c]);
else if(len[c]==2) cur.pb(val[c]/2),cur.pb(val[c]%2);
}
for(int i=59;i>=0;i--) ans=ans*2+cur[i];
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
33 ms |
2328 KB |
Output is partially correct - L* = 14 |
2 |
Partially correct |
30 ms |
2340 KB |
Output is partially correct - L* = 14 |
3 |
Partially correct |
34 ms |
2340 KB |
Output is partially correct - L* = 14 |
4 |
Partially correct |
29 ms |
2332 KB |
Output is partially correct - L* = 14 |
5 |
Partially correct |
38 ms |
2300 KB |
Output is partially correct - L* = 14 |
6 |
Partially correct |
30 ms |
2248 KB |
Output is partially correct - L* = 14 |
7 |
Partially correct |
35 ms |
2320 KB |
Output is partially correct - L* = 14 |
8 |
Partially correct |
36 ms |
2176 KB |
Output is partially correct - L* = 14 |
9 |
Partially correct |
32 ms |
2228 KB |
Output is partially correct - L* = 14 |
10 |
Partially correct |
34 ms |
2248 KB |
Output is partially correct - L* = 14 |
11 |
Partially correct |
31 ms |
2396 KB |
Output is partially correct - L* = 14 |
12 |
Partially correct |
33 ms |
2256 KB |
Output is partially correct - L* = 14 |
13 |
Partially correct |
28 ms |
2236 KB |
Output is partially correct - L* = 14 |
14 |
Partially correct |
31 ms |
2332 KB |
Output is partially correct - L* = 14 |
15 |
Partially correct |
34 ms |
2352 KB |
Output is partially correct - L* = 14 |
16 |
Partially correct |
33 ms |
2292 KB |
Output is partially correct - L* = 14 |
17 |
Partially correct |
28 ms |
2276 KB |
Output is partially correct - L* = 14 |
18 |
Partially correct |
30 ms |
2264 KB |
Output is partially correct - L* = 14 |
19 |
Partially correct |
31 ms |
2256 KB |
Output is partially correct - L* = 14 |
20 |
Partially correct |
32 ms |
2336 KB |
Output is partially correct - L* = 14 |
21 |
Partially correct |
29 ms |
2300 KB |
Output is partially correct - L* = 14 |
22 |
Partially correct |
33 ms |
2444 KB |
Output is partially correct - L* = 14 |
23 |
Partially correct |
38 ms |
2420 KB |
Output is partially correct - L* = 14 |
24 |
Partially correct |
28 ms |
2284 KB |
Output is partially correct - L* = 14 |
25 |
Partially correct |
29 ms |
2248 KB |
Output is partially correct - L* = 14 |
26 |
Partially correct |
31 ms |
2216 KB |
Output is partially correct - L* = 14 |
27 |
Partially correct |
33 ms |
2328 KB |
Output is partially correct - L* = 14 |
28 |
Partially correct |
31 ms |
2248 KB |
Output is partially correct - L* = 14 |
29 |
Partially correct |
44 ms |
2304 KB |
Output is partially correct - L* = 14 |
30 |
Partially correct |
32 ms |
2312 KB |
Output is partially correct - L* = 14 |
31 |
Partially correct |
29 ms |
2248 KB |
Output is partially correct - L* = 14 |
32 |
Partially correct |
29 ms |
2244 KB |
Output is partially correct - L* = 14 |
33 |
Partially correct |
35 ms |
2300 KB |
Output is partially correct - L* = 14 |
34 |
Partially correct |
29 ms |
2304 KB |
Output is partially correct - L* = 14 |
35 |
Partially correct |
37 ms |
2328 KB |
Output is partially correct - L* = 14 |
36 |
Partially correct |
33 ms |
2172 KB |
Output is partially correct - L* = 14 |
37 |
Partially correct |
32 ms |
2440 KB |
Output is partially correct - L* = 14 |
38 |
Partially correct |
31 ms |
2360 KB |
Output is partially correct - L* = 14 |
39 |
Partially correct |
28 ms |
2244 KB |
Output is partially correct - L* = 14 |
40 |
Partially correct |
30 ms |
2324 KB |
Output is partially correct - L* = 14 |