Пример #1
0
int main() {
    int i, j, k;
    while(1) {
        scanf("%d%d", &n, &m);
        if(n == 0 && m == 0)return 0;
        ansx = ansy = INF;
        for(i = 0; i < n; i++)
            for(j = 0; j < n; j++)
                scanf("%d", &field[i][j]);

        for(i = 0; i < m; i++)
            for(j = 0; j < m; j++)
                scanf("%d", &pict[i][j]);

        for(i = 0; i + m - 1 < n; i++) {
            for(j = 0; j + m - 1 < n; j++) {
                for(k = 0; k < 4; k++) {
                    mach(i, j, k);
                }
            }
        }
        if(ansx == INF)
            puts("NA");
        else
            printf("%d %d\n", ansy, ansx);
    }
}
Пример #2
0
inline void spawn(
  spawn_type spw,
  actor<stackless>& sire, match_t func, SpawnHandler h,
  match_t ctxid = ctxid_nil,
  link_type type = no_link,
  std::size_t stack_size = default_stacksize(),
  seconds_t tmo = seconds_t(GCE_DEFAULT_REQUEST_TIMEOUT_SEC)
  )
{
  aid_t aid;
  sid_t sid = sire.spawn(spw, func, ctxid, stack_size);
  boost::uint16_t err = 0;
  sid_t ret_sid = sid_nil;

  duration_t curr_tmo = tmo;
  typedef boost::chrono::system_clock clock_t;
  clock_t::time_point begin_tp = clock_t::now();
  match mach(curr_tmo);
  mach.match_list_.push_back(detail::msg_spawn_ret);
  sire.recv(
    boost::bind(
      &handle_remote_spawn, _1, _2, _3,
      type, begin_tp, sid, tmo, curr_tmo, spawn_handler_t(h)
      ),
    mach
    );
}
Пример #3
0
inline void handle_remote_spawn(
  actor<stackless>& self, aid_t aid,
  message msg, link_type type,
  boost::chrono::system_clock::time_point begin_tp,
  sid_t sid, seconds_t tmo, duration_t curr_tmo,
  spawn_handler_t const& hdr
  )
{
  boost::uint16_t err = 0;
  sid_t ret_sid = sid_nil;
  msg >> err >> ret_sid;

  do
  {
    if (err != 0 || (aid && sid == ret_sid))
    {
      break;
    }

    if (tmo != infin)
    {
      duration_t pass_time = boost::chrono::system_clock::now() - begin_tp;
      curr_tmo -= pass_time;
    }

    begin_tp = boost::chrono::system_clock::now();
    match mach(curr_tmo);
    mach.match_list_.push_back(detail::msg_spawn_ret);
    self.recv(
      boost::bind(
        &handle_remote_spawn, _1, _2, _3,
        type, begin_tp, sid, tmo, curr_tmo, hdr
        ),
      mach
      );
    return;
  }
  while (false);

  detail::spawn_error error = (detail::spawn_error)err;
  if (error != detail::spawn_ok)
  {
    aid = aid_t();
  }

  if (aid)
  {
    if (type == linked)
    {
      self.link(aid);
    }
    else if (type == monitored)
    {
      self.monitor(aid);
    }
  }

  hdr(self, aid);
}
Пример #4
0
//
// Retrieves the shared library info address pointer.
//
ErrorCode MachOProcess::getSharedLibraryInfoAddress(Address &address) {
  return mach().getProcessDylbInfo(_info.pid, address);
}