先找到一条多边形的边,然后循环一圈输出多边形上的点.把每个三角形看作一个结点,以两个三角形之间公用边为边建立一张图,DFS输出叶子结点,则得到先切后切的顺序. #define HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h> using namespace std; vector<]; ]; void dfs(int x){ vis[x]=; for(auto it:v[x]) if(!vis[it]) dfs(it); cout<<x…
contest链接: https://codeforces.com/contest/1282 A. Temporarily unavailable 题意: 给一个区间L,R通有网络,有个点x,在x+r和x-r范围内,没有网络,问在这个区间上有网络的长度范围 思路:枚举区间覆盖情况,注意细节 AC代码: #include<iostream> #include<string> #include<vector> #include<cstring> #include…
A. Maze 题目连接: http://codeforces.com/contest/377/problem/A Description Pavel loves grid mazes. A grid maze is an n × m rectangle maze where each cell is either empty, or is a wall. You can go from one cell to another only if both cells are empty and h…
C. Xor-tree Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/430/problem/C Description Iahub is very proud of his recent discovery, propagating trees. Right now, he invented a new tree, called xor-tree. After this new revolu…
D. MADMAX time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output As we all know, Max is the best video game player among her friends. Her friends were so jealous of hers, that they created an actu…
题目链接:http://codeforces.com/contest/767/problem/C 题解:类似于提着一串葡萄,用剪刀剪两条藤,葡萄分成了三串.问怎样剪才能使三串葡萄的质量相等. 首先要做的就是统计葡萄的总质量tot.之后就是找到两子串质量为(tot/3)的葡萄(如果除不尽,则必定找不到),那么剩下的就是dfs搜索了. 我一开始的做法是先建一棵记录子树质量和的树,然后再从上往下dfs,如果找到了,就把它剪掉.后来发现被剪掉的那一串可能就含有两串质量为(tot/3)的葡萄(这里质量 可…
C. Cardiogram time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output In this problem, your task is to use ASCII graphics to paint a cardiogram. A cardiogram is a polyline with the following corner…
题意:给出一棵树,共有n个节点,其中根节点是Kefa的家,叶子是restaurant,a[i]....a[n]表示i节点是否有猫,问:Kefa要去restaurant并且不能连续经过m个有猫的节点有多少条路径: 思路:先用vector数组建树: 再dfs..(第一次用vector建树,还看了别人的代码,果然是zz): 代码: #include <bits/stdc++.h> #define ll long long #define MAXN 100000+10 using namespace…
C. Thor time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fascinated…
D. Fedor and Essay time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output After you had helped Fedor to find friends in the «Call of Soldiers 3» game, he stopped studying completely. Today, the E…