SPOJ #691. Hotel Floors】的更多相关文章

A typical flood-fill algorithm application (BFS). Not very complex, except only 1 tip: instead of searching for new space, I keep all spaces(occupied or not) in a hash_map that gets updated in a flood-fill. #include <vector> #include <stack> #…
A. Saitama Destroys Hotel   Saitama accidentally destroyed a hotel again. To repay the hotel company, Genos has volunteered to operate an elevator in one of its other hotels. The elevator is special — it starts on the top floor, can only move down, a…
A. Saitama Destroys Hotel 题目连接: http://www.codeforces.com/contest/608/problem/A Description Saitama accidentally destroyed a hotel again. To repay the hotel company, Genos has volunteered to operate an elevator in one of its other hotels. The elevato…
  A. Saitama Destroys Hotel   time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Saitama accidentally destroyed a hotel again. To repay the hotel company, Genos has volunteered to operate an e…
Saitama accidentally destroyed a hotel again. To repay the hotel company, Genos has volunteered to operate an elevator in one of its other hotels. The elevator is special - it starts on the top floor, can only move down, and has infinite capacity. Fl…
A. Saitama Destroys Hotel time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Saitama accidentally destroyed a hotel again. To repay the hotel company, Genos has volunteered to operate an eleva…
2588: Spoj 10628. Count on a tree Time Limit: 12 Sec  Memory Limit: 128 MBSubmit: 5217  Solved: 1233[Submit][Status][Discuss] Description 给定一棵N个节点的树,每个点有一个权值,对于M个询问(u,v,k),你需要回答u xor lastans和v这两个节点间第K小的点权.其中lastans是上一个询问的答案,初始为0,即第一个询问的u是明文. Input 第一…
题目 Source http://www.spoj.com/problems/DQUERY/en/ Description Given a sequence of n numbers a1, a2, ..., an and a number of d-queries. A d-query is a pair (i, j) (1 ≤ i ≤ j ≤ n). For each d-query (i, j), you have to return the number of distinct elem…
SPOJ - GSS3 Can you answer these queries III Description You are given a sequence A of N (N <= 50000) integers between -10000 and 10000. On this sequence you have to apply M (M <= 50000) operations: modify the i-th element in the sequence or for giv…
这题是学主席树的时候就想写的,,, 但是当时没写(懒) 现在来填坑 = =日常调半天lca(考虑以后背板) 主席树还是蛮好写的,但是代码出现重复,不太好,导致调试的时候心里没底(虽然事实证明主席树部分没出问题) #include <cstdio> #include <algorithm> using namespace std; ]; ]; ,N=,lastans=; ],nex[],list[]; ],h[],fir[],root[],f[],pos[]; ],near[],rm…