# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
400886 | duality | Broken Device (JOI17_broken_device) | C++11 | 51 ms | 2472 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |