#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 = 183465712312354678LL;
int bad[150],Q[150];
void Anna(int N,long long int X,int K,int P[]) {
X ^= y;
int i,c = 0;
for (i = 0; i < N; i++) Q[i] = i,bad[i] = 0;
for (i = 0; i < N; i++) swap(Q[i],Q[y % (i+1)]);
for (i = 0; i < K; i++) bad[P[i]] = 1;
for (i = 0; i < N; i += 3) {
int t = 0,o = 0,o2 = 0;
if (((X >> c) & 3) == 0) t = 3;
else if (((X >> c) & 3) == 1) t = 5;
else if (((X >> c) & 3) == 2) t = 6;
else t = 7;
if ((X >> c) & 1) o = o2 = 2;
else o = 1,o2 = 4;
if (!((t & 1) && bad[Q[i]]) && !((t & 2) && bad[Q[i+1]]) && !((t & 4) && bad[Q[i+2]])) {
Set(Q[i],t & 1);
Set(Q[i+1],(t >> 1) & 1);
Set(Q[i+2],(t >> 2) & 1);
c += 2;
}
else if (!((o & 1) && bad[Q[i]]) && !((o & 2) && bad[Q[i+1]]) && !((o & 4) && bad[Q[i+2]])) {
Set(Q[i],o & 1);
Set(Q[i+1],(o >> 1) & 1);
Set(Q[i+2],(o >> 2) & 1);
c++;
}
else if (!((o2 & 1) && bad[Q[i]]) && !((o2 & 2) && bad[Q[i+1]]) && !((o2 & 4) && bad[Q[i+2]])) {
Set(Q[i],o2 & 1);
Set(Q[i+1],(o2 >> 1) & 1);
Set(Q[i+2],(o2 >> 2) & 1);
c++;
}
else Set(Q[i],0),Set(Q[i+1],0),Set(Q[i+2],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 = 183465712312354678LL;
vi vv;
int QQ[150];
long long int Bruno(int N,int A[]) {
int i,c = 0;
LLI X = 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 < N; i += 3) {
int b = A[QQ[i]] | (A[QQ[i+1]] << 1) | (A[QQ[i+2]] << 2);
if (b == 7) X |= (3LL << c),c += 2;
else if (b == 6) X |= (2LL << c),c += 2;
else if (b == 5) X |= (1LL << c),c += 2;
else if (b == 3) c += 2;
else if (b == 4) c++;
else if (b == 2) X |= (1LL << c),c++;
else if (b == 1) c++;
}
X ^= yy;
return X;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
46 ms |
2320 KB |
Output is partially correct - L* = 37 |
2 |
Partially correct |
46 ms |
2404 KB |
Output is partially correct - L* = 39 |
3 |
Partially correct |
46 ms |
2380 KB |
Output is partially correct - L* = 38 |
4 |
Partially correct |
46 ms |
2400 KB |
Output is partially correct - L* = 35 |
5 |
Partially correct |
46 ms |
2344 KB |
Output is partially correct - L* = 37 |
6 |
Partially correct |
48 ms |
2444 KB |
Output is partially correct - L* = 38 |
7 |
Correct |
51 ms |
2280 KB |
Output is correct - L* = 40 |
8 |
Partially correct |
46 ms |
2280 KB |
Output is partially correct - L* = 38 |
9 |
Correct |
46 ms |
2328 KB |
Output is correct - L* = 40 |
10 |
Partially correct |
46 ms |
2444 KB |
Output is partially correct - L* = 39 |
11 |
Partially correct |
46 ms |
2376 KB |
Output is partially correct - L* = 38 |
12 |
Partially correct |
46 ms |
2416 KB |
Output is partially correct - L* = 38 |
13 |
Partially correct |
46 ms |
2316 KB |
Output is partially correct - L* = 37 |
14 |
Correct |
46 ms |
2292 KB |
Output is correct - L* = 40 |
15 |
Partially correct |
46 ms |
2280 KB |
Output is partially correct - L* = 37 |
16 |
Partially correct |
45 ms |
2472 KB |
Output is partially correct - L* = 37 |
17 |
Partially correct |
47 ms |
2352 KB |
Output is partially correct - L* = 37 |
18 |
Partially correct |
47 ms |
2376 KB |
Output is partially correct - L* = 39 |
19 |
Partially correct |
46 ms |
2340 KB |
Output is partially correct - L* = 37 |
20 |
Partially correct |
46 ms |
2344 KB |
Output is partially correct - L* = 37 |
21 |
Partially correct |
45 ms |
2396 KB |
Output is partially correct - L* = 37 |
22 |
Partially correct |
48 ms |
2416 KB |
Output is partially correct - L* = 37 |
23 |
Partially correct |
50 ms |
2336 KB |
Output is partially correct - L* = 39 |
24 |
Partially correct |
46 ms |
2396 KB |
Output is partially correct - L* = 38 |
25 |
Partially correct |
46 ms |
2340 KB |
Output is partially correct - L* = 38 |
26 |
Partially correct |
47 ms |
2328 KB |
Output is partially correct - L* = 39 |
27 |
Partially correct |
46 ms |
2308 KB |
Output is partially correct - L* = 37 |
28 |
Partially correct |
46 ms |
2404 KB |
Output is partially correct - L* = 37 |
29 |
Partially correct |
46 ms |
2376 KB |
Output is partially correct - L* = 39 |
30 |
Partially correct |
46 ms |
2436 KB |
Output is partially correct - L* = 39 |
31 |
Partially correct |
46 ms |
2420 KB |
Output is partially correct - L* = 38 |
32 |
Partially correct |
46 ms |
2384 KB |
Output is partially correct - L* = 38 |
33 |
Partially correct |
46 ms |
2360 KB |
Output is partially correct - L* = 38 |
34 |
Partially correct |
46 ms |
2348 KB |
Output is partially correct - L* = 37 |
35 |
Partially correct |
46 ms |
2384 KB |
Output is partially correct - L* = 39 |
36 |
Partially correct |
48 ms |
2264 KB |
Output is partially correct - L* = 39 |
37 |
Partially correct |
46 ms |
2312 KB |
Output is partially correct - L* = 37 |
38 |
Partially correct |
46 ms |
2328 KB |
Output is partially correct - L* = 38 |
39 |
Partially correct |
46 ms |
2340 KB |
Output is partially correct - L* = 38 |
40 |
Partially correct |
46 ms |
2316 KB |
Output is partially correct - L* = 39 |