//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include "doll.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
#define mem(a,v) memset((a), (v), sizeof (a))
#define enl printf("\n")
#define case(t) printf("Case #%d: ", (t))
#define ni(n) scanf("%d", &(n))
#define nl(n) scanf("%I64d", &(n))
#define nai(a, n) for (int i = 0; i < (n); i++) ni(a[i])
#define nal(a, n) for (int i = 0; i < (n); i++) nl(a[i])
#define pri(n) printf("%d\n", (n))
#define prl(n) printf("%I64d\n", (n))
#define pii pair<int, int>
#define pil pair<int, long long>
#define pll pair<long long, long long>
#define vii vector<pii>
#define vil vector<pil>
#define vll vector<pll>
#define vi vector<int>
#define vl vector<long long>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef cc_hash_table<int,int,hash<int>> ht;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;
const double pi = acos(-1);
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const int MAXN = 1e6 + 5;
const double eps = 1e-9;
int n, p=1, cnt=1;
bool mrk[MAXN];
vi x, y;
int build(int l, int r) {
if (l >= r) return 0;
if (r + n < p) return -1;
int cur = cnt++;
int m = (l+r) / 2;
//x.pb(0), y.pb(0);
x[cur-1] = build(l, m);
y[cur-1] = build(m+1, r);
return -cur;
}
void upd(int i, int j) {
int &cur = mrk[-i] ? y[-(i+1)] : x[-(i+1)];
mrk[-i] = !mrk[-i];
if (!cur)
cur = j;
else
upd(cur, j);
}
void create_circuit(int m, vi a) {
x.resize(MAXN);
y.resize(MAXN);
n = a.size();
while (p < n) p <<= 1;
build(0, p - 1);
for (int i = 1; i < n; i++)
upd(-1, a[i]);
if (n & 1)
upd(-1, -1);
upd(-1, 0);
vi c(m+1, -1);
c[0] = a[0];
x.resize(cnt);
y.resize(cnt);
answer(c, x, y);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
8012 KB |
Output is correct |
2 |
Correct |
49 ms |
10828 KB |
Output is correct |
3 |
Correct |
76 ms |
10504 KB |
Output is correct |
4 |
Correct |
6 ms |
8012 KB |
Output is correct |
5 |
Correct |
17 ms |
9292 KB |
Output is correct |
6 |
Correct |
74 ms |
11700 KB |
Output is correct |
7 |
Correct |
5 ms |
8140 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
8012 KB |
Output is correct |
2 |
Correct |
49 ms |
10828 KB |
Output is correct |
3 |
Correct |
76 ms |
10504 KB |
Output is correct |
4 |
Correct |
6 ms |
8012 KB |
Output is correct |
5 |
Correct |
17 ms |
9292 KB |
Output is correct |
6 |
Correct |
74 ms |
11700 KB |
Output is correct |
7 |
Correct |
5 ms |
8140 KB |
Output is correct |
8 |
Correct |
90 ms |
12036 KB |
Output is correct |
9 |
Correct |
93 ms |
12468 KB |
Output is correct |
10 |
Correct |
159 ms |
14108 KB |
Output is correct |
11 |
Correct |
6 ms |
8140 KB |
Output is correct |
12 |
Correct |
6 ms |
8140 KB |
Output is correct |
13 |
Correct |
6 ms |
8012 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
8012 KB |
Output is correct |
2 |
Correct |
49 ms |
10828 KB |
Output is correct |
3 |
Correct |
76 ms |
10504 KB |
Output is correct |
4 |
Correct |
6 ms |
8012 KB |
Output is correct |
5 |
Correct |
17 ms |
9292 KB |
Output is correct |
6 |
Correct |
74 ms |
11700 KB |
Output is correct |
7 |
Correct |
5 ms |
8140 KB |
Output is correct |
8 |
Correct |
90 ms |
12036 KB |
Output is correct |
9 |
Correct |
93 ms |
12468 KB |
Output is correct |
10 |
Correct |
159 ms |
14108 KB |
Output is correct |
11 |
Correct |
6 ms |
8140 KB |
Output is correct |
12 |
Correct |
6 ms |
8140 KB |
Output is correct |
13 |
Correct |
6 ms |
8012 KB |
Output is correct |
14 |
Correct |
144 ms |
13792 KB |
Output is correct |
15 |
Correct |
94 ms |
11716 KB |
Output is correct |
16 |
Correct |
147 ms |
13576 KB |
Output is correct |
17 |
Correct |
8 ms |
8132 KB |
Output is correct |
18 |
Correct |
5 ms |
8024 KB |
Output is correct |
19 |
Correct |
6 ms |
8100 KB |
Output is correct |
20 |
Correct |
161 ms |
13856 KB |
Output is correct |
21 |
Correct |
8 ms |
8136 KB |
Output is correct |
22 |
Correct |
5 ms |
8012 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
8140 KB |
Output is correct |
2 |
Correct |
6 ms |
8040 KB |
Output is correct |
3 |
Correct |
5 ms |
8096 KB |
Output is correct |
4 |
Correct |
7 ms |
8012 KB |
Output is correct |
5 |
Correct |
6 ms |
8044 KB |
Output is correct |
6 |
Correct |
5 ms |
8012 KB |
Output is correct |
7 |
Correct |
6 ms |
8012 KB |
Output is correct |
8 |
Correct |
5 ms |
8032 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
8140 KB |
Output is correct |
2 |
Correct |
85 ms |
11324 KB |
Output is correct |
3 |
Correct |
83 ms |
11312 KB |
Output is correct |
4 |
Correct |
150 ms |
12968 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
8140 KB |
Output is correct |
2 |
Correct |
85 ms |
11324 KB |
Output is correct |
3 |
Correct |
83 ms |
11312 KB |
Output is correct |
4 |
Correct |
150 ms |
12968 KB |
Output is correct |
5 |
Correct |
169 ms |
13488 KB |
Output is correct |
6 |
Correct |
133 ms |
13600 KB |
Output is correct |
7 |
Correct |
138 ms |
13676 KB |
Output is correct |
8 |
Correct |
148 ms |
13296 KB |
Output is correct |
9 |
Correct |
88 ms |
11328 KB |
Output is correct |
10 |
Correct |
133 ms |
13168 KB |
Output is correct |
11 |
Correct |
142 ms |
12996 KB |
Output is correct |
12 |
Correct |
89 ms |
11316 KB |
Output is correct |
13 |
Correct |
88 ms |
11572 KB |
Output is correct |
14 |
Correct |
90 ms |
11676 KB |
Output is correct |
15 |
Correct |
97 ms |
11816 KB |
Output is correct |
16 |
Correct |
7 ms |
8268 KB |
Output is correct |
17 |
Correct |
83 ms |
11328 KB |
Output is correct |
18 |
Correct |
101 ms |
11332 KB |
Output is correct |
19 |
Correct |
96 ms |
11324 KB |
Output is correct |
20 |
Correct |
126 ms |
13092 KB |
Output is correct |
21 |
Correct |
148 ms |
12956 KB |
Output is correct |
22 |
Correct |
143 ms |
12960 KB |
Output is correct |