![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
题解
文章平均质量分 76
yang_zhao_xiong
这个作者很懒,什么都没留下…
展开
-
二哥的内存
疯了疯了,在OJ上做去年的一道机考题,提交了25次,其中超过时间限制14次,答案错误4次,运行时错误4次,终于赢下了这场攻坚战,并从中提炼出一条朴素的真理:cout是很慢的…… 题目链接:http://acm.sjtu.edu.cn/OnlineJudge/problem/1053 问题描述如下:一个规模为100000 * 100000的稀疏矩阵,其中至多100原创 2014-12-26 15:42:51 · 673 阅读 · 0 评论 -
Codeforces 290C
题意:给出一组没有按字母表排序的英文名字,要求找出一种新的字母表顺序,使这组名字符合该字母表序。 解法:拓扑排序的应用,注意判断 xy 在 x 之前的情况。// Codeforces 290C#include#include#include#includeusing namespace std;class alphaGraph{private: struct e原创 2015-02-17 13:30:36 · 420 阅读 · 0 评论 -
hihocoder 1077线段树
按自己理解写了个拙劣的线段树。 内存居然用了47MB,不知道这样的程序最多在计算机里能占用多少内存// hiho1077 segment tree#include#include#includeusing namespace std;struct segNode{ int s; int e; int min;};segNode tree[3000100原创 2015-02-22 11:30:31 · 409 阅读 · 0 评论 -
hihocoder 1050
题意为求一棵树中的最长路径。这里采用两次BFS的办法。任选一个结点作为根结点, 记为A。以A为起点进行一次BFS,可以证明,最远路径的端点一定是离A最远的点。证明如下: 若A是最远路径的一个端点,则距离A最远的点也一定是最远路径的端点; 若A不是最远路径的端点,设一条最远路径为BC,A连接到BC之间的一点,假设BC都不是离A最远的点,设最远点为D,则可证明DB和原创 2015-02-10 16:51:34 · 509 阅读 · 2 评论 -
hihoCoder 1121 二部图判定
直接上代码……// hiho 1121#include#include#includeusing namespace std;class graph{private: struct edgeNode{ int end; edgeNode* next; edgeNode() : next(NULL) {} edgeNode(int e, edgeNod原创 2015-03-22 17:00:18 · 471 阅读 · 0 评论 -
Codeforces 294D
STL map的运用// Codeforces 294D#include#include#include#include#includeusing namespace std;int main(){ int val[26], i; long long res = 0, prefixSum[100100]; char str[100100]; for (i =原创 2015-03-14 20:11:14 · 361 阅读 · 0 评论 -
Codeforces 296C
写了个简单的AVL,只插入不删除。当然Tutorial里给出的解法更简单// Codeforces 296C#include#include#includeusing namespace std;class AVL{private: struct AVLNode{ int begin; int end; int heig原创 2015-05-08 23:43:35 · 468 阅读 · 0 评论 -
Codeforces 312C
直接用暴力解法,把小于等于最大数的数字都试一遍。// 312C#include #include #include using namespace std;struct link{ int num; link* next; link(int no, link* n) : num(no), next(n) {} link() : next(NULL) {}};stru原创 2015-07-27 15:14:47 · 291 阅读 · 0 评论