Submission #291764

#TimeUsernameProblemLanguageResultExecution timeMemory
291764fivefourthreeoneMechanical Doll (IOI18_doll)C++17
Compilation error
0 ms0 KiB
//#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]; /*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<<" "; } cout<<"\n"; }*/ void create_circuit(int M, vector<int> A) { n = A.size(); m = M; if(n==1) { vector<int> c(m+1, 0); vector<int> x(0); vector<int> y(0); c[0] = A[0]; answer(c, x, y); } vector<int> c(m+1, -1); c[0] = A[0]; int h = 0; int num = 1; while(num < n) { num*=2; h++; } int cnt = 1; owo(i, 0, num) { int curr = 0; int nxt; if(i < n-1) { owo(j, 0, h-1) { if(st[curr]) { if(arr[curr].second==0) { arr[curr].second = -(cnt++); } nxt = -arr[curr].second; }else { if(arr[curr].first==0) { arr[curr].first = -(cnt++); } nxt = -arr[curr].first; } st[curr]^=1; curr = nxt; } if(st[curr]) { arr[curr].second = A[i+1] + 1; }else { arr[curr].first = A[i+1] + 1; } st[curr]^=1; }else { owo(j, 0, h) { if(st[curr]) { if(arr[curr].second==0&&i==num-1) { arr[curr].second = 1; nxt = 0; break; } nxt = -arr[curr].second; }else { nxt = -arr[curr].first; } st[curr]^=1; if(nxt==0) break; curr = nxt; } } } vector<int> x(cnt); vector<int> y(cnt); owo(i, 0, cnt) { x[i] = arr[i].first - 1; y[i] = arr[i].second - 1; } 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")
      | 
doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:56:9: error: 'answer' was not declared in this scope
   56 |         answer(c, x, y);
      |         ^~~~~~
doll.cpp:116:5: error: 'answer' was not declared in this scope
  116 |     answer(c, x, y);
      |     ^~~~~~