Submission #839157

# Submission time Handle Problem Language Result Execution time Memory
839157 2023-08-28T21:38:19 Z beaconmc Mechanical Doll (IOI18_doll) C++14
37 / 100
58 ms 8876 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();





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



  FOR(i, 0, 30){
    if (N < 2*(1<<i)){

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

      vector<ll> order = binorder(i);
      vector<ll> order2 = binorder(i);
      for (auto&k : order2){
        order.push_back(k + (1<<i));
      }



      FOR(j,0,order.size()){
        if (order[j] < A.size()){
          if (j >= (1<<i)) Y[j-1] = A[order[j]];
          else X[j+(1<<i)-1] = A[order[j]];
        }
      }





      break;

    }
  }







  // 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);


}




Compilation message

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:10:35: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 | #define FOR(i, x, y) for(ll i=x; i<y; i++)
......
   72 |       FOR(j,0,order.size()){
      |           ~~~~~~~~~~~~~~~~         
doll.cpp:72:7: note: in expansion of macro 'FOR'
   72 |       FOR(j,0,order.size()){
      |       ^~~
doll.cpp:73:22: warning: comparison of integer expressions of different signedness: '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   73 |         if (order[j] < A.size()){
doll.cpp:35:6: warning: unused variable 'offset' [-Wunused-variable]
   35 |   ll offset = 0;
      |      ^~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 212 KB Output is partially correct
2 Partially correct 46 ms 7612 KB Output is partially correct
3 Partially correct 46 ms 7488 KB Output is partially correct
4 Partially correct 51 ms 8000 KB Output is partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 212 KB Output is partially correct
2 Partially correct 46 ms 7612 KB Output is partially correct
3 Partially correct 46 ms 7488 KB Output is partially correct
4 Partially correct 51 ms 8000 KB Output is partially correct
5 Partially correct 58 ms 8876 KB Output is partially correct
6 Partially correct 57 ms 8700 KB Output is partially correct
7 Partially correct 55 ms 8740 KB Output is partially correct
8 Partially correct 55 ms 8492 KB Output is partially correct
9 Partially correct 47 ms 7560 KB Output is partially correct
10 Partially correct 53 ms 8500 KB Output is partially correct
11 Partially correct 55 ms 8132 KB Output is partially correct
12 Partially correct 47 ms 7728 KB Output is partially correct
13 Partially correct 49 ms 8124 KB Output is partially correct
14 Partially correct 49 ms 8188 KB Output is partially correct
15 Partially correct 49 ms 8244 KB Output is partially correct
16 Partially correct 2 ms 596 KB Output is partially correct
17 Correct 28 ms 4344 KB Output is correct
18 Partially correct 48 ms 7712 KB Output is partially correct
19 Partially correct 47 ms 7756 KB Output is partially correct
20 Partially correct 54 ms 8272 KB Output is partially correct
21 Partially correct 52 ms 8064 KB Output is partially correct
22 Partially correct 53 ms 8128 KB Output is partially correct