Submission #1237369

#TimeUsernameProblemLanguageResultExecution timeMemory
1237369mychecksedadMechanical Doll (IOI18_doll)C++20
18 / 100
14 ms1864 KiB
#include "doll.h"
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define vi vector<int>
#define ff first
#define ss second
#define ll long long int
#define pii pair<int,int>
const int N = 1e5+100, M = 5010, K = 22;

void create_circuit(int m, std::vector<int> A) {
  assert(m == 1);
  int n = A.size();

  int sw = 1;
  for(int i = 0; ; ++i){
    if((1<<i) - 1 >= n){
      sw = i;
      break;
    }
  }  
  vi C(m + 1);
  C[0] = -1;
  C[1] = -1;
  int sz = sw;
  // cerr << sw << " crap\n";
  vi X(sz), Y(sz);
  for(int i = 0; i < sw; ++i){
    Y[i] = (i + 1 == sw ? 0 : -(i + 2));
    if(!((1<<(sw-i-1))&n)){
      X[i] = -1;
    }else{
      X[i] = 1;
    }
    // cerr << X[i] << ' ' << Y[i] << '\n';
  }

  answer(C, X, Y);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...