This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// why is there always this nvim thing where all numbers increase by 1 if you accidentally press sth
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define pb emplace_back
int rev(int bits, int n) {
int ans = 0;
REP(i,0,bits) if(n&(1<<i)) ans |= (1<<(bits-1-i));
return ans;
}
#ifdef DEBUG
#define state printf
#define RTEfind printf("Line %d\n",__LINE__)
#else
#define state(...) 69
#define RTEfind 42
#endif
void create_circuit(int M, std::vector<int> A) {
state("create circuit called\n");
A.pb(0);
RTEfind;
int N = A.size();
RTEfind;
vector<int> C;
RTEfind;
REP(i,0,M+1) C.pb(-1);
RTEfind;
int log = 0; while((1<<log)<N) log++;
RTEfind;
int no[(2<<log)];
RTEfind;
REP(i,1<<log,2<<log) no[i]=-(i+N<(2<<log));
RTEfind;
RREP(i,1<<log,1) no[i]=-(no[i<<1]+no[i<<1|1]==-2);
RTEfind;
int cnt = 0;
RTEfind;
REP(i,1,1<<log) if(no[i]!=-1) no[i]=cnt++;
REP(i,1,1<<log) state("no[%d]=%d\n",i,no[i]);
RTEfind;
vector<int> X, Y; X.resize(cnt); Y.resize(cnt);
RTEfind;
REP(i,1,1<<log) if(no[i]!=-1) X[no[i]]=(no[i<<1]==-1?-1:-no[i<<1]-1), Y[no[i]]=(no[i<<1|1]==-1?-1:-no[i<<1|1]-1);
RTEfind;
int cur = -1;
RTEfind;
REP(i,0,N) {
RTEfind;
do {cur++;} while(rev(log,cur)+N<(1<<log));
RTEfind;
int hi = rev(log, cur) | (1<<log);
state("cur=%d,log=%d,hi=%d\n",cur,log,hi);
RTEfind;
if(hi&1) Y[no[hi>>1]]=A[i];
else X[no[hi>>1]]=A[i];
RTEfind;
}
RTEfind;
answer(C,X,Y);
}
Compilation message (stderr)
doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:18:21: warning: statement has no effect [-Wunused-value]
18 | #define state(...) 69
| ^~
doll.cpp:22:2: note: in expansion of macro 'state'
22 | state("create circuit called\n");
| ^~~~~
doll.cpp:19:18: warning: statement has no effect [-Wunused-value]
19 | #define RTEfind 42
| ^~
doll.cpp:24:2: note: in expansion of macro 'RTEfind'
24 | RTEfind;
| ^~~~~~~
doll.cpp:19:18: warning: statement has no effect [-Wunused-value]
19 | #define RTEfind 42
| ^~
doll.cpp:26:2: note: in expansion of macro 'RTEfind'
26 | RTEfind;
| ^~~~~~~
doll.cpp:19:18: warning: statement has no effect [-Wunused-value]
19 | #define RTEfind 42
| ^~
doll.cpp:28:2: note: in expansion of macro 'RTEfind'
28 | RTEfind;
| ^~~~~~~
doll.cpp:19:18: warning: statement has no effect [-Wunused-value]
19 | #define RTEfind 42
| ^~
doll.cpp:30:2: note: in expansion of macro 'RTEfind'
30 | RTEfind;
| ^~~~~~~
doll.cpp:19:18: warning: statement has no effect [-Wunused-value]
19 | #define RTEfind 42
| ^~
doll.cpp:32:2: note: in expansion of macro 'RTEfind'
32 | RTEfind;
| ^~~~~~~
doll.cpp:19:18: warning: statement has no effect [-Wunused-value]
19 | #define RTEfind 42
| ^~
doll.cpp:34:2: note: in expansion of macro 'RTEfind'
34 | RTEfind;
| ^~~~~~~
doll.cpp:19:18: warning: statement has no effect [-Wunused-value]
19 | #define RTEfind 42
| ^~
doll.cpp:36:2: note: in expansion of macro 'RTEfind'
36 | RTEfind;
| ^~~~~~~
doll.cpp:19:18: warning: statement has no effect [-Wunused-value]
19 | #define RTEfind 42
| ^~
doll.cpp:38:2: note: in expansion of macro 'RTEfind'
38 | RTEfind;
| ^~~~~~~
doll.cpp:19:18: warning: statement has no effect [-Wunused-value]
19 | #define RTEfind 42
| ^~
doll.cpp:40:2: note: in expansion of macro 'RTEfind'
40 | RTEfind;
| ^~~~~~~
doll.cpp:18:21: warning: statement has no effect [-Wunused-value]
18 | #define state(...) 69
| ^~
doll.cpp:42:18: note: in expansion of macro 'state'
42 | REP(i,1,1<<log) state("no[%d]=%d\n",i,no[i]);
| ^~~~~
doll.cpp:19:18: warning: statement has no effect [-Wunused-value]
19 | #define RTEfind 42
| ^~
doll.cpp:43:2: note: in expansion of macro 'RTEfind'
43 | RTEfind;
| ^~~~~~~
doll.cpp:19:18: warning: statement has no effect [-Wunused-value]
19 | #define RTEfind 42
| ^~
doll.cpp:45:2: note: in expansion of macro 'RTEfind'
45 | RTEfind;
| ^~~~~~~
doll.cpp:19:18: warning: statement has no effect [-Wunused-value]
19 | #define RTEfind 42
| ^~
doll.cpp:47:2: note: in expansion of macro 'RTEfind'
47 | RTEfind;
| ^~~~~~~
doll.cpp:19:18: warning: statement has no effect [-Wunused-value]
19 | #define RTEfind 42
| ^~
doll.cpp:49:2: note: in expansion of macro 'RTEfind'
49 | RTEfind;
| ^~~~~~~
doll.cpp:19:18: warning: statement has no effect [-Wunused-value]
19 | #define RTEfind 42
| ^~
doll.cpp:51:2: note: in expansion of macro 'RTEfind'
51 | RTEfind;
| ^~~~~~~
doll.cpp:19:18: warning: statement has no effect [-Wunused-value]
19 | #define RTEfind 42
| ^~
doll.cpp:53:3: note: in expansion of macro 'RTEfind'
53 | RTEfind;
| ^~~~~~~
doll.cpp:18:21: warning: statement has no effect [-Wunused-value]
18 | #define state(...) 69
| ^~
doll.cpp:55:3: note: in expansion of macro 'state'
55 | state("cur=%d,log=%d,hi=%d\n",cur,log,hi);
| ^~~~~
doll.cpp:19:18: warning: statement has no effect [-Wunused-value]
19 | #define RTEfind 42
| ^~
doll.cpp:56:3: note: in expansion of macro 'RTEfind'
56 | RTEfind;
| ^~~~~~~
doll.cpp:19:18: warning: statement has no effect [-Wunused-value]
19 | #define RTEfind 42
| ^~
doll.cpp:59:3: note: in expansion of macro 'RTEfind'
59 | RTEfind;
| ^~~~~~~
doll.cpp:19:18: warning: statement has no effect [-Wunused-value]
19 | #define RTEfind 42
| ^~
doll.cpp:61:2: note: in expansion of macro 'RTEfind'
61 | RTEfind;
| ^~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |