This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "doll.h"
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#define owo(i,a, b) for(auto i=(a);i<(b); ++i)
#define uwu(i,a, b) for(auto i=(a)-1; i>=(b); --i)
#define senpai push_back
#define ttgl pair<int, int>
#define ayaya cout<<"ayaya~"<<endl
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<ttgl, null_type,less<ttgl>, rb_tree_tag,tree_order_statistics_node_update>*/
using ll = long long;
using ld = long double;
const ll MOD = 998244353;
const ll root = 62;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
ll binpow(ll a,ll b){ll res=1;while(b){if(b&1)res=(res*a)%MOD;a=(a*a)%MOD;b>>=1;}return res;}
ll modInv(ll a){return binpow(a, MOD-2);}
const double PI = acos(-1);
const double eps = 1e-6;
const int INF = 0x3f3f3f3f;
const int NINF = 0xc0c0c0c0;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll NINFLL = 0xc0c0c0c0c0c0c0c0;
const int mxN = 400001;
int n, m;
ttgl arr[mxN];
int st[mxN];
int cnt = 1, num =1;
/*void answer(vector<int> c, vector<int> x, vector<int> y) {
for(int k: c) {
cout<<k<<" ";
}
cout<<"\n";
for(int k: x) {
cout<<k<<" ";
}
cout<<"\n";
for(int k: y) {
cout<<k<<" ";
}
}*/
vector<int> c, x, y;
int dfs(int l, int r) {
if(l>=r)return 0;
if(r<num - n)return -1;
int mid = (l + r) >> 1;
int pos = cnt++;
arr[pos-1].first = dfs(l, mid);
arr[pos-1].second = dfs(mid+1, r);
return -pos;
}
void create_circuit(int M, vector<int> A) {
n = A.size();
m = M;
if(n==1) {
c.resize(m+1, 0);
x.resize(0);
y.resize(0);
c[0] = A[0];
answer(c, x, y);
}
c.resize(m+1, -1);
c[0] = A[0];
while(num < n) {
num*=2;
}
dfs(0, num-1);
x.resize(cnt);
y.resize(cnt);
owo(i, 0, cnt) {
x[i] = arr[i].first;
y[i] = arr[i].second;
}
answer(c, x, y);
}
/*int N, M;
vector<int> in;
int main() {
freopen("file.in", "r", stdin);
//freopen("file.out", "w", stdout);
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
cin.tie(0)->sync_with_stdio(0);
cin>>N>>M;
in.resize(N);
owo(i, 0, N) {
cin>>in[i];
}
create_circuit(M, in);
return 0;
}*/
Compilation message (stderr)
doll.cpp:3: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
3 | #pragma GCC optimization ("O3")
|
doll.cpp:4: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
4 | #pragma GCC optimization ("unroll-loops")
|
# | 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... |