Submission #839075

# Submission time Handle Problem Language Result Execution time Memory
839075 2023-08-28T15:06:54 Z beaconmc Mechanical Doll (IOI18_doll) C++14
0 / 100
1 ms 212 KB
#include "doll.h"
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

typedef int ll;
using namespace std;
//using namespace __gnu_pbds;

#define FOR(i, x, y) for(ll i=x; i<y; i++)
#define FORNEG(i, x, y) for(ll i=x; i>y; i--)
//#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)





vector<ll> binorder(ll n){
  if (n==0) return {0};
  vector<ll> ans;
  vector<ll> sus = binorder(n-1);
  for (auto&i : sus){
    ans.push_back(i*2);
  }
  for (auto&i : sus){
    ans.push_back(i*2 + 1);
  }
  return ans;
}



void create_circuit(int M, vector<int> A) {
  ll offset = 0;
  ll N = A.size();

  reverse(A.begin(), A.end());


  vector<ll> X;
  vector<ll> Y;
  vector<ll> ans;
  ans.push_back(-1);
  FOR(i, 1, M+1){
    ans.push_back(-1);
  }


  FORNEG(i, 30, -1){
    if (N&(1<<i)){

      N -= (1<<i);

      vector<ll> things;
      vector<ll> order = binorder(i);


      FOR(j,0,(1<<i)){
        things.push_back(A[A.size()-1]);
        A.pop_back();
      }


      if (i==0){
        Y.push_back(0);
        X.push_back(things[0]);
        ans[things[0]] = offset-1;
        continue;
      }


      FOR(j, 1, (1<<(i))){
        X.push_back(-(j*2+offset));
        Y.push_back(-(j*2+1+offset));
      }

      ll shit = 0;
      FOR(j,(1<<(i)), (1<<(i+1))){
        Y.push_back(offset-1);
        X.push_back(things[order[shit++]]);
        ans[things[order[shit-1]]] = offset-1;
      }
      if (N != 0){
        Y[Y.size()-1] = -X.size()-1;
      }
      offset = -X.size();

    }
  }






  for (auto&i : ans){
    cout << i << " ";
  }cout << endl;
  for (auto&i : X){
    cout << i << " ";

  }cout << endl;

  for (auto&i : Y){
    cout << i << " ";

  }cout << endl;
  Y[Y.size()-1] = 0;

  answer(ans, X, Y);


}




# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB DO NOT PRINT ANYTHING TO STANDARD OUTPUT
2 Halted 0 ms 0 KB -