#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> P;
typedef vector<vi> vvi;
typedef vector<P> vp;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define REP(i,k,n) for(ll i=(ll)(k);i<(ll)(n);i++)
#define all(a) a.begin(),a.end()
#define fi first
#define se second
#define pb emplace_back
const ll inf=1001001001001001;
template<class T> void out(T a){cout<<a<<endl;}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<endl;}
void create_circuit(int M, vector<int> A) {
ll n=A.size();
vi v;
v.pb(0);
for(int i=n-1;i>0;i--)v.pb(A[i]);
vector<pair<vi,ll>> ord;
rep(i,v.size()){
vi al;
rep(j,19)al.pb(i>>j&1);
ord.pb(al,i);
}
sort(all(ord));
vi tmp(ord.size());
rep(i,ord.size())tmp[ord[i].se]=v[i];
vp res;
ll cnt=0;
while(tmp.size()>1){
vi ntmp;
rep(j,tmp.size()/2){
ntmp.pb(--cnt);
res.pb(tmp[j*2+1],tmp[j*2]);
}
if(tmp.size()%2){
ntmp.pb(--cnt);
res.pb(inf,tmp.back());
}
tmp=ntmp;
}
vector<int> C(M+1,tmp[0]);
C[0]=A[0];
rep(i,res.size())if(res[i].fi==inf)res[i].fi=tmp[0];
vector<int> X,Y;
for(auto x:res){
X.pb(x.fi);Y.pb(x.se);
}
answer(C,X,Y);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
108 ms |
18128 KB |
Output is correct |
3 |
Correct |
95 ms |
18448 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
8 ms |
1364 KB |
Output is correct |
6 |
Correct |
161 ms |
27500 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
108 ms |
18128 KB |
Output is correct |
3 |
Correct |
95 ms |
18448 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
8 ms |
1364 KB |
Output is correct |
6 |
Correct |
161 ms |
27500 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
267 ms |
34368 KB |
Output is correct |
9 |
Correct |
224 ms |
36032 KB |
Output is correct |
10 |
Correct |
352 ms |
52912 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
108 ms |
18128 KB |
Output is correct |
3 |
Correct |
95 ms |
18448 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
8 ms |
1364 KB |
Output is correct |
6 |
Correct |
161 ms |
27500 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
267 ms |
34368 KB |
Output is correct |
9 |
Correct |
224 ms |
36032 KB |
Output is correct |
10 |
Correct |
352 ms |
52912 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
345 ms |
52152 KB |
Output is correct |
15 |
Correct |
225 ms |
36056 KB |
Output is correct |
16 |
Correct |
363 ms |
53356 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
296 KB |
Output is correct |
19 |
Correct |
0 ms |
212 KB |
Output is correct |
20 |
Correct |
366 ms |
54132 KB |
Output is correct |
21 |
Correct |
1 ms |
212 KB |
Output is correct |
22 |
Correct |
1 ms |
304 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
296 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
304 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
253 ms |
34828 KB |
Output is correct |
3 |
Correct |
206 ms |
35884 KB |
Output is correct |
4 |
Correct |
335 ms |
53140 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
253 ms |
34828 KB |
Output is correct |
3 |
Correct |
206 ms |
35884 KB |
Output is correct |
4 |
Correct |
335 ms |
53140 KB |
Output is correct |
5 |
Correct |
359 ms |
53360 KB |
Output is correct |
6 |
Correct |
360 ms |
53232 KB |
Output is correct |
7 |
Correct |
355 ms |
53292 KB |
Output is correct |
8 |
Correct |
380 ms |
53228 KB |
Output is correct |
9 |
Correct |
236 ms |
35872 KB |
Output is correct |
10 |
Correct |
345 ms |
53136 KB |
Output is correct |
11 |
Correct |
346 ms |
53128 KB |
Output is correct |
12 |
Correct |
228 ms |
35856 KB |
Output is correct |
13 |
Correct |
231 ms |
34840 KB |
Output is correct |
14 |
Correct |
252 ms |
36012 KB |
Output is correct |
15 |
Correct |
229 ms |
35984 KB |
Output is correct |
16 |
Correct |
4 ms |
1360 KB |
Output is correct |
17 |
Correct |
242 ms |
34836 KB |
Output is correct |
18 |
Correct |
241 ms |
34828 KB |
Output is correct |
19 |
Correct |
229 ms |
35984 KB |
Output is correct |
20 |
Correct |
340 ms |
53112 KB |
Output is correct |
21 |
Correct |
361 ms |
53124 KB |
Output is correct |
22 |
Correct |
402 ms |
53164 KB |
Output is correct |