コード例 #1
0
ファイル: A.cpp プロジェクト: ftiasch/acm-icpc
int main()
{
    scanf("%d%d", &n, &m);
    for (int i = 0; i < n; ++ i) {
        scanf("%d%d", l + i, r + i);
    }
    for (int i = 0; i < m; ++ i) {
        scanf("%d%d%d", a + i, b + i, c + i);
    }
    solve();
    solve_inner();
    for (int i = 0; i < n; ++ i) {
        l[i] *= -1;
        r[i] *= -1;
        std::swap(l[i], r[i]);
    }
    for (int i = 0; i < m; ++ i) {
        a[i] *= -1;
        b[i] *= -1;
        std::swap(a[i], b[i]);
    }
    solve();
    if (result.first) {
        std::cout << result.first << std::endl << result.second.first + 1 << " " << result.second.second + 1 << std::endl;
    } else {
        puts("0");
    }
    return 0;
}
コード例 #2
0
ファイル: OLCDijkstra.cpp プロジェクト: Plantain/XCSoar
bool
OLCDijkstra::solve()
{
  if (m_dijkstra.empty()) {
    set_weightings();
    n_points = olc.get_trace_points(m_full_trace).size();
  }

  if (n_points < num_stages)
    return false;

  if (m_dijkstra.empty()) {
    m_dijkstra.reset(ScanTaskPoint(0, 0));
    add_start_edges();
    if (m_dijkstra.empty())
      // no processing to perform!
      // @todo
      // problem with this is it will immediately ask
      // OnlineContest for new data, which will be expensive
      // instead, new data should arrive only when preconditions
      // are satisfied (significant difference and valid)
      return true;
  }

  return solve_inner();
}