답안 #546210

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
546210 2022-04-06T16:19:07 Z blue Broken Device 2 (JOI22_device2) C++17
0 / 100
70 ms 904 KB
#include "Anna.h"
#include <utility>
#include <vector>
#include <iostream>
using namespace std;

namespace {

int variable_example = 0;
using ll = long long;

const int bits = 6;
const int bs = 3;

}

int Declare() {
  return bs * bits;
}


std::pair<std::vector<int>, std::vector<int> > Anna(long long A) {
  
  vector<int> S, T;
  for(int i = 0; i < bits*bs/2; i++)
  {
    S.push_back(0);
    S.push_back(1);
  }

  ll pow2[bits];
  pow2[0] = 1;
  for(int e = 1; e < bits; e++)
    pow2[e] = 2LL * pow2[e-1];

  for(int i = 0; i < bits; i++)
  {
    for(int j = 0; j < bs; j++)
    {
      T.push_back(bool(A & pow2[i]));
    }
  }

  for(int i = 0; i < bits*bs; i++) cerr << S[i];
    cerr << '\n';
  for(int i = 0; i < bits*bs; i++) cerr << T[i];
    cerr << '\n';

  return make_pair(S, T);
}
#include "Bruno.h"
#include <utility>
#include <vector>
#include <iostream>
using namespace std;


namespace {

int variable_example = 0;
using vi = vector<int>;
using ll = long long;

const int bits = 6;
const int bs = 3;

}

long long Bruno(vi u) {
  int sm = 0;

  ll res = 0;
  ll cp = 1;

  // cerr << "u = ";
  // for(int k:u) cerr << k;
  //   cerr << '\n';

  for(int i = 0; i < 2 * bits*bs; i++)
  {
   if(u[i] == 0) sm++;
   else sm--;

   // cerr << i << " : " << sm << '\n';

   if(sm == bs)
    {
      cp *= 2;
      sm -= bs;
      // cerr << "+ detected\n";
    }
    else if(sm == -bs + 1)
    {
      res += cp;
      // cerr << "adding " << cp << '\n';
      cp *= 2;
      sm += bs;
      // cerr << "- detected\n";
    }
  }
  // cerr << "returning " << res << '\n';
  return res;
}

Compilation message

Anna.cpp:9:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
    9 | int variable_example = 0;
      |     ^~~~~~~~~~~~~~~~

Bruno.cpp:10:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
   10 | int variable_example = 0;
      |     ^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 516 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 516 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 516 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 516 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 516 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 70 ms 904 KB Output isn't correct
2 Halted 0 ms 0 KB -