#define DEBUG 0
#include <bits/stdc++.h>
using namespace std;
#if DEBUG
// basic debugging macros
int __i__,__j__;
#define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl
#define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printArr(a,l) cout<<#a<<": ";for(__i__=0;__i__<l;__i__++){cout<<a[__i__]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<a[__i__][__j__]<<" ";}cout<<endl;}
#define print2dArr2(a,r,c,l) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<setw(l)<<setfill(' ')<<a[__i__][__j__]<<" ";}cout<<endl;}
// advanced debugging class
// debug 1,2,'A',"test";
class _Debug {
public:
template<typename T>
_Debug& operator,(T val) {
cout << val << endl;
return *this;
}
};
#define debug _Debug(),
#else
#define printLine(l)
#define printLine2(l,c)
#define printVar(n)
#define printArr(a,l)
#define print2dArr(a,r,c)
#define print2dArr2(a,r,c,l)
#define debug
#endif
// define
#define MAX_VAL 999999999
#define MAX_VAL_2 999999999999999999LL
#define EPS 1e-6
#define mp make_pair
#define pb push_back
// typedef
typedef unsigned int UI;
typedef long long int LLI;
typedef unsigned long long int ULLI;
typedef unsigned short int US;
typedef pair<int,int> pii;
typedef pair<LLI,LLI> plli;
typedef vector<int> vi;
typedef vector<LLI> vlli;
typedef vector<pii> vpii;
typedef vector<plli> vplli;
// ---------- END OF TEMPLATE ----------
#include "Annalib.h"
vi v;
LLI y = 193465712312354678LL;
int Q[150];
void Anna(int N,long long int X,int K,int P[]) {
X ^= y;
int i,j,c = 0,s = 0;
for (i = 0; i < N; i++) Q[i] = i;
for (i = 0; i < N; i++) swap(Q[i],Q[y % (i+1)]);
v.pb(2),v.pb(4),v.pb(6);
for (i = 0; i < 100; i++) v.pb(8);
int bad[150];
for (i = 0; i < N; i++) bad[i] = 0;
for (i = 0; i < K; i++) bad[P[i]] = 1;
i = 0;
while (i < N) {
if ((i+v[s]-1 < N) && !bad[Q[i]]) {
for (j = 0; j < v[s]-1; j++) {
if (bad[Q[i+1+j]] && (X & (1LL << (c+j)))) break;
}
if (j == v[s]-1) {
Set(Q[i],1);
for (j = 0; j < v[s]-1; j++) {
if (X & (1LL << (c+j))) Set(Q[i+1+j],1);
else Set(Q[i+1+j],0);
}
i += v[s],c += v[s]-1,s++;
}
else Set(Q[i],0),i++,s = 0;
}
else Set(Q[i],0),i++,s = 0;
}
}
#define DEBUG 0
#include <bits/stdc++.h>
using namespace std;
#if DEBUG
// basic debugging macros
int __i__,__j__;
#define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl
#define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printArr(a,l) cout<<#a<<": ";for(__i__=0;__i__<l;__i__++){cout<<a[__i__]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<a[__i__][__j__]<<" ";}cout<<endl;}
#define print2dArr2(a,r,c,l) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<setw(l)<<setfill(' ')<<a[__i__][__j__]<<" ";}cout<<endl;}
// advanced debugging class
// debug 1,2,'A',"test";
class _Debug {
public:
template<typename T>
_Debug& operator,(T val) {
cout << val << endl;
return *this;
}
};
#define debug _Debug(),
#else
#define printLine(l)
#define printLine2(l,c)
#define printVar(n)
#define printArr(a,l)
#define print2dArr(a,r,c)
#define print2dArr2(a,r,c,l)
#define debug
#endif
// define
#define MAX_VAL 999999999
#define MAX_VAL_2 999999999999999999LL
#define EPS 1e-6
#define mp make_pair
#define pb push_back
// typedef
typedef unsigned int UI;
typedef long long int LLI;
typedef unsigned long long int ULLI;
typedef unsigned short int US;
typedef pair<int,int> pii;
typedef pair<LLI,LLI> plli;
typedef vector<int> vi;
typedef vector<LLI> vlli;
typedef vector<pii> vpii;
typedef vector<plli> vplli;
// ---------- END OF TEMPLATE ----------
#include "Brunolib.h"
LLI yy = 193465712312354678LL;
vi vv;
int QQ[150];
long long int Bruno(int N,int A[]) {
int i,j,s = 0,c = 0;
vv.pb(2),vv.pb(4),vv.pb(6);
for (i = 0; i < N; i++) QQ[i] = i;
for (i = 0; i < N; i++) swap(QQ[i],QQ[yy % (i+1)]);
for (i = 0; i < 100; i++) vv.pb(8);
LLI X = 0;
i = 0;
while (i < N) {
if ((i+vv[s]-1 < N) && A[QQ[i]]) {
for (j = 0; j < vv[s]-1; j++) {
if (A[QQ[i+1+j]]) X |= (1LL << (c+j));
}
i += vv[s],c += vv[s]-1,s++;
}
else i++,s = 0;
}
X ^= yy;
return X;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
47 ms |
3744 KB |
Output is partially correct - L* = 37 |
2 |
Partially correct |
48 ms |
3900 KB |
Output is partially correct - L* = 37 |
3 |
Partially correct |
47 ms |
3836 KB |
Output is partially correct - L* = 37 |
4 |
Partially correct |
47 ms |
3656 KB |
Output is partially correct - L* = 34 |
5 |
Partially correct |
49 ms |
3632 KB |
Output is partially correct - L* = 37 |
6 |
Partially correct |
47 ms |
3712 KB |
Output is partially correct - L* = 37 |
7 |
Partially correct |
47 ms |
3740 KB |
Output is partially correct - L* = 37 |
8 |
Partially correct |
47 ms |
3764 KB |
Output is partially correct - L* = 37 |
9 |
Partially correct |
47 ms |
3660 KB |
Output is partially correct - L* = 37 |
10 |
Partially correct |
49 ms |
3704 KB |
Output is partially correct - L* = 38 |
11 |
Partially correct |
47 ms |
3728 KB |
Output is partially correct - L* = 37 |
12 |
Partially correct |
47 ms |
3672 KB |
Output is partially correct - L* = 37 |
13 |
Partially correct |
47 ms |
3684 KB |
Output is partially correct - L* = 37 |
14 |
Partially correct |
48 ms |
3736 KB |
Output is partially correct - L* = 37 |
15 |
Partially correct |
47 ms |
3668 KB |
Output is partially correct - L* = 37 |
16 |
Partially correct |
47 ms |
3692 KB |
Output is partially correct - L* = 37 |
17 |
Partially correct |
47 ms |
3680 KB |
Output is partially correct - L* = 37 |
18 |
Partially correct |
46 ms |
3736 KB |
Output is partially correct - L* = 35 |
19 |
Partially correct |
47 ms |
3628 KB |
Output is partially correct - L* = 37 |
20 |
Partially correct |
50 ms |
3824 KB |
Output is partially correct - L* = 37 |
21 |
Partially correct |
52 ms |
3676 KB |
Output is partially correct - L* = 37 |
22 |
Partially correct |
47 ms |
3680 KB |
Output is partially correct - L* = 37 |
23 |
Partially correct |
47 ms |
3728 KB |
Output is partially correct - L* = 37 |
24 |
Partially correct |
47 ms |
3648 KB |
Output is partially correct - L* = 37 |
25 |
Partially correct |
47 ms |
3796 KB |
Output is partially correct - L* = 37 |
26 |
Partially correct |
47 ms |
3780 KB |
Output is partially correct - L* = 37 |
27 |
Partially correct |
47 ms |
3860 KB |
Output is partially correct - L* = 37 |
28 |
Partially correct |
47 ms |
3756 KB |
Output is partially correct - L* = 36 |
29 |
Partially correct |
47 ms |
3848 KB |
Output is partially correct - L* = 38 |
30 |
Partially correct |
47 ms |
3744 KB |
Output is partially correct - L* = 38 |
31 |
Partially correct |
48 ms |
3808 KB |
Output is partially correct - L* = 37 |
32 |
Partially correct |
47 ms |
3664 KB |
Output is partially correct - L* = 36 |
33 |
Partially correct |
47 ms |
3704 KB |
Output is partially correct - L* = 37 |
34 |
Partially correct |
46 ms |
3760 KB |
Output is partially correct - L* = 38 |
35 |
Partially correct |
48 ms |
3844 KB |
Output is partially correct - L* = 33 |
36 |
Partially correct |
47 ms |
3744 KB |
Output is partially correct - L* = 35 |
37 |
Partially correct |
47 ms |
3732 KB |
Output is partially correct - L* = 37 |
38 |
Partially correct |
49 ms |
3644 KB |
Output is partially correct - L* = 37 |
39 |
Partially correct |
48 ms |
3728 KB |
Output is partially correct - L* = 37 |
40 |
Partially correct |
47 ms |
3688 KB |
Output is partially correct - L* = 37 |