题意:给一个n,代表n次操作,接下来每次操作表示把[l,r]区间的线段涂成k的颜色其中,l,r,k的范围都是0到8000
分析:其实就是拿线段树维护一段区间的颜色,总体用到的是线段树的区间更新把,但是会给人一种区间合并的错觉
注意:这题比较坑的是千万不能拿n建树,不然就会segmentation fault,必须拿8000建树,也就是树是固定的
代码:
#inclu...
分类:
其他 时间:
2015-08-17 17:25:50
收藏:
0 评论:
0 赞:
0 阅读:
228
package main
import (
"archive/tar"
"bufio"
"bytes"
"compress/gzip"
"flag"
"fmt"
"io"
"net/http"
"os"
"os/exec"
"regexp"
"sort"
"text/template"
"time"
)
type ID_info map[string]string
...
分类:
其他 时间:
2015-08-17 17:25:40
收藏:
0 评论:
0 赞:
0 阅读:
167
Revenge of LIS II
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1258 Accepted Submission(s): 423
Problem Description
In comput...
分类:
其他 时间:
2015-08-17 17:25:30
收藏:
0 评论:
0 赞:
0 阅读:
273
题目Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm’s runtime complexity must be in the order of O(log n).If the target is not found in the...
分类:
其他 时间:
2015-08-17 17:25:20
收藏:
0 评论:
0 赞:
0 阅读:
191
题目链接
http://poj.org/problem?id=2431
Expedition
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 9243
Accepted: 2700
Description
A group of cows grab...
分类:
其他 时间:
2015-08-17 17:25:10
收藏:
0 评论:
0 赞:
0 阅读:
228
题目地址:POJ 2661
题意:从1960年开始,每10年更新一次计算机的最长存储位数,其中,最开始的1960年字长为4位,以后每隔10年就增长一倍的长度。给你一个年份,问这一年时,计算机可以执行n!而不溢出的最大的n值。
思路:第n年的位数k=2^(2+(y-1960)/10),能放在k位中最大的无符号整数是(2^k)-1,如果是直接求不大于(2^k)-1的n!很容易溢出且速度慢,那么我们就...
分类:
其他 时间:
2015-08-17 17:25:00
收藏:
0 评论:
0 赞:
0 阅读:
155
Time Limit : 5000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other)
Total Submission(s) : 45 Accepted Submission(s) : 30
Problem Description
在每年的校赛里,所有进入决赛的同学都会获得一件很漂亮的t-shirt。但是每当我们...
分类:
其他 时间:
2015-08-17 17:24:50
收藏:
0 评论:
0 赞:
0 阅读:
129
CO-PRIME
时间限制:1000 ms | 内存限制:65535 KB
难度:3
描述
This problem is so easy! Can you solve it?
You are given a sequence which contains n integers a1,a2……an, your task is to find how many pa...
分类:
其他 时间:
2015-08-17 17:24:00
收藏:
0 评论:
0 赞:
0 阅读:
117
变形课
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others)
Total Submission(s): 18343 Accepted Submission(s): 6597
Problem Description
呃......变形课上Harry碰到了一...
分类:
其他 时间:
2015-08-17 17:23:50
收藏:
0 评论:
0 赞:
0 阅读:
174
2242: [SDOI2011]计算器Time Limit: 10 Sec Memory Limit: 512 MB
Submit: 2077 Solved: 812
Description你被要求设计一个计算器完成以下三项任务:
1、给定y,z,p,计算Y^Z Mod P 的值;
2、给定y,z,p,计算满足xy≡ Z ( mod P )的最小非负整数;
3、给定y,z,p,计算满足Y^...
分类:
其他 时间:
2015-08-17 17:23:46
收藏:
0 评论:
0 赞:
0 阅读:
182
Description
Given a connected undirected graph, tell if its minimum spanning tree is unique.
Definition 1 (Spanning Tree): Consider a connected, undirected graph G = (V, E). A spanning tree o...
分类:
其他 时间:
2015-08-17 17:23:45
收藏:
0 评论:
0 赞:
0 阅读:
152
Binary Tree PathsGiven a binary tree, return all root-to-leaf paths.For example, given the following binary tree:
All root-to-leaf paths are:[“1->2->5”, “1->3”]分析
深度搜索class Solution {
public:
v...
分类:
其他 时间:
2015-08-17 17:23:21
收藏:
0 评论:
0 赞:
0 阅读:
209
假定一个方法isSubstring.可检查一个单词是否为其他字符串的子串。给定两个字符串s1和s2。请编写代码检查s2是否为s1旋转而成,要求只调用一次isSubstring.(比如,waterbottle是erbottlewat旋转后的字符串)
上述分析正是这个问题的解法:直接调用isSubstring(s1s1,s2)即可。
bool isRotation(string s...
分类:
其他 时间:
2015-08-17 17:23:10
收藏:
0 评论:
0 赞:
0 阅读:
196
Number Sequence
Time Limit: 1000MS
Memory Limit: 10000K
Total Submissions: 35823
Accepted: 10340
Description
A single positive integer i is given. Write a program to fi...
分类:
其他 时间:
2015-08-17 17:23:00
收藏:
0 评论:
0 赞:
0 阅读:
220
appleMenu
body{margin:0px auto;padding:0px auto;}
#menuBar{width:100%;height:70px;position:absolute;bottom:0px;text-align: center;}
#menuBar img{width:70px;height:70px...
分类:
其他 时间:
2015-08-17 17:22:50
收藏:
0 评论:
0 赞:
0 阅读:
112
题目:点击打开链接
分析:注意细节。
#include
int a1[1000010];
int calcue(int x)
{
int len=1;
while(x!=1)
{
if(x%2==0)
{
x=x/2;
len+=1;
}
if(x==1)
return len...
分类:
其他 时间:
2015-08-17 17:22:20
收藏:
0 评论:
0 赞:
0 阅读:
115
题目Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the array.Her...
分类:
其他 时间:
2015-08-17 17:22:00
收藏:
0 评论:
0 赞:
0 阅读:
127
最短路
Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 42651 Accepted Submission(s): 18683
Problem Description
在每年的校赛里,所有进入决赛的同学都会获得一件很...
分类:
其他 时间:
2015-08-17 17:21:50
收藏:
0 评论:
0 赞:
0 阅读:
154
找循环节,分解质因数,求LCM
Infoplane in Tina Town
Time Limit: 14000/7000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)
Total Submission(s): 1627 Accepted Submission(s): 380
Pro...
分类:
其他 时间:
2015-08-17 17:21:30
收藏:
0 评论:
0 赞:
0 阅读:
131
【题目链接】click here~~
【题目大意】类型于中国象棋里面“马”的走法,给你两个坐标,一个初始坐标,一个最终坐标,在保证有解的情况下最小的步数
【思路】BFS的话,直接模拟,因为棋盘比较小
(1)BFS +队列
代码:(3ms)
#include
using namespace std;
int dir8[8][2]= {{1,2},{2,1},{-1,2},{-2,1},{...
分类:
其他 时间:
2015-08-17 17:20:50
收藏:
0 评论:
0 赞:
0 阅读:
194