ZOJ2477 Magic Cube
题目:
This is a very popular game for children. In this game, there's a cube, which consists of 3 * 3 * 3 small cubes. We can unwrap the cube, it will become like this:
w w w
w w w
w w w
r r r g g g b b b o o o
r r r g g g b b b o o o
r r r g g g b b b o o o
y y y
y y y
y y y
The letters means the color on the small cubes. For example, 'r' means red, 'g' means green, 'y' means yellow....The goal for this game is to rotate the faces of the cube to make each of the faces contains only one color. Note there're exact 6 kind of colors on the cube and there're exact 9 small rectangles totally in any time in the game.
Do you know how to rotate the faces? I think most of you have known it. But I would like to show it again. When a face is rotated, the configuration of colors in all the adjacent faces changes. For the cube above, after we rotate the green face clock-wise, the last line of 'w' face will become the left column of 'b' face, the left column of 'b' face will become the top line of 'y' face, etc. As you may know, reaching the final position from a scrambled configuration can be quite challenging.
In this problem, you are given a configuration of the cube, and asked to give a way to reach the final position. To reduce the difficulty, the steps required will never be greater than 5.
输入:
The input contains an integer in the first line, which indicates the number of the test cases. In each test case, there're exact 10 lines. The first line is an empty line. The next 9 lines contain a configuration. The format can be seen in the sample input. For simplicity, we give an index to each face as follows:
/---\
| |
| 4 |
| |
/---+---+---+---\
| | | | |
| 0 | 1 | 2 | 3 |
| | | | |
\---+---+---+---/
| |
| 5 |
| |
\---/
Note that there's a space between two adjacent letters.
输出:
For each test case, the first line of the output is the smallest count N of the steps to reach the winning position. If the winning position can't be reached in 5 steps, print -1 in this line. Otherwise print each step in one line in the following N lines. A step contains two integers, the first one means the face index, and the second one means the direction. 1 means clock-wise and -1 means counter clock-wise. If the given position is the winning position, print 0 for such test case simply. If there're multiple solutions, any one is acceptable.
样例:
分析:我。。。自闭了两天竟然是没有写>5输出-1(°ཀ°),为什么我会默认测试点必然可以在5步内实现啊(#`Д´)ノ
只能说这个模拟太恶心了!!!
用IDA*优化,思路是计算每一个面有几个和中心方格颜色不一样的方格,6个面的总数除12并向上取整是最少剩余需要的步数(如果最理想的情况加上已走步数仍然大于5那肯定没戏啊)
模拟写得相当丑(灬ºωº灬)
- #include<iostream>
- #include<sstream>
- #include<cstdio>
- #include<cstdlib>
- #include<string>
- #include<cstring>
- #include<algorithm>
- #include<functional>
- #include<iomanip>
- #include<numeric>
- #include<cmath>
- #include<queue>
- #include<vector>
- #include<set>
- #include<cctype>
- #define PI acos(-1.0)
- const int INF = 0x3f3f3f3f;
- const int NINF = -INF - ;
- typedef long long ll;
- using namespace std;
- char cube[][];
- struct node
- {
- char maze[][];
- };
- struct cur
- {
- char maze[][];
- };
- node clockwise(node temp)
- {
- char gtm[][];
- gtm[][] = temp.maze[][];
- gtm[][] = temp.maze[][];
- gtm[][] = temp.maze[][];
- gtm[][] = temp.maze[][];
- gtm[][] = temp.maze[][];
- gtm[][] = temp.maze[][];
- gtm[][] = temp.maze[][];
- gtm[][] = temp.maze[][];
- gtm[][] = temp.maze[][];
- memcpy(temp.maze, gtm, sizeof(temp.maze));
- return temp;
- }
- node cclockwise(node temp)
- {
- char gtm[][];
- gtm[][] = temp.maze[][];
- gtm[][] = temp.maze[][];
- gtm[][] = temp.maze[][];
- gtm[][] = temp.maze[][];
- gtm[][] = temp.maze[][];
- gtm[][] = temp.maze[][];
- gtm[][] = temp.maze[][];
- gtm[][] = temp.maze[][];
- gtm[][] = temp.maze[][];
- memcpy(temp.maze, gtm, sizeof(temp.maze));
- return temp;
- }
- int bol, ans;
- pair<int, int> P[];
- void print()
- {
- for (int i = ; i < ans; ++i)
- cout << P[i].first << ' ' << P[i].second << endl;
- }
- int hx(cur trans)
- {
- double sum = ;
- for (int i = ; i < ; ++i)
- {
- for (int j = ; j < ; j += )
- if (trans.maze[i][j] != trans.maze[][]) sum++;
- }
- for (int i = ; i < ; ++i)
- {
- for (int j = ; j < ; j += )
- if (trans.maze[i][j] != trans.maze[][]) sum++;
- }
- for (int i = ; i < ; ++i)
- {
- for (int j = ; j < ; j += )
- if (trans.maze[i][j] != trans.maze[][]) sum++;
- }
- for (int i = ; i < ; ++i)
- {
- for (int j = ; j < ; j += )
- if (trans.maze[i][j] != trans.maze[][]) sum++;
- }
- for (int i = ; i < ; ++i)
- {
- for (int j = ; j < ; j += )
- if (trans.maze[i][j] != trans.maze[][]) sum++;
- }
- for (int i = ; i < ; ++i)
- {
- for (int j = ; j < ; j += )
- if (trans.maze[i][j] != trans.maze[][]) sum++;
- }
- return ceil(sum / );
- }
- void dfs(int rec, char pos[][], int deep)
- {
- if (rec > deep) return;
- cur trans;
- memcpy(trans.maze, pos, sizeof(trans.maze));
- int h = hx(trans);
- //cout << "test:" << h << endl;
- if (h == )
- {
- ans = rec;
- cout << rec << endl;
- bol = ;
- return;
- }
- if (h + rec > deep) return;
- for (int i = ; i < ; ++i)
- {
- char tmp[][];
- memcpy(tmp, pos, sizeof(tmp));
- /*for (int j = 0; j < 9; ++j)
- cout << tmp[j] << endl;
- return;*/
- node temp;
- if (i == )
- {
- for (int k = , m = ; k < , m < ; ++k, ++m)
- {
- for (int j = , n = ; j < , n < ; j += , ++n)
- temp.maze[m][n] = tmp[k][j];
- }
- temp = clockwise(temp);
- /*for (int m = 0; m < 3; ++m)
- {
- for (int n = 0; n < 3; ++n)
- cout << temp.maze[m][n] << ' ';
- cout << endl;
- }*/
- for (int k = , m = ; k < , m < ; ++k, ++m)
- {
- for (int j = , n = ; j < , n < ; j += , ++n)
- tmp[k][j] = temp.maze[m][n];
- }
- char cpy[][];
- memcpy(cpy, tmp, sizeof(cpy));
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- memcpy(tmp, cpy, sizeof(tmp));
- /*for (int k = 0; k < 9; ++k)
- cout << tmp[k] << endl;
- return;*/
- }
- else if (i == )
- {
- for (int k = , m = ; k < , m < ; ++k, ++m)
- {
- for (int j = , n = ; j < , n < ; j += , ++n)
- temp.maze[m][n] = tmp[k][j];
- }
- temp = cclockwise(temp);
- for (int k = , m = ; k < , m < ; ++k, ++m)
- {
- for (int j = , n = ; j < , n < ; j += , ++n)
- tmp[k][j] = temp.maze[m][n];
- }
- char cpy[][];
- memcpy(cpy, tmp, sizeof(cpy));
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- memcpy(tmp, cpy, sizeof(tmp));
- /*for (int k = 0; k < 9; ++k)
- cout << tmp[k] << endl;
- return;*/
- }
- else if (i == )
- {
- for (int k = , m = ; k < , m < ; ++k, ++m)
- {
- for (int j = , n = ; j < , n < ; j += , ++n)
- temp.maze[m][n] = tmp[k][j];
- }
- temp = clockwise(temp);
- for (int k = , m = ; k < , m < ; ++k, ++m)
- {
- for (int j = , n = ; j < , n < ; j += , ++n)
- tmp[k][j] = temp.maze[m][n];
- }
- char cpy[][];
- memcpy(cpy, tmp, sizeof(cpy));
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- memcpy(tmp, cpy, sizeof(tmp));
- /*for (int k = 0; k < 9; ++k)
- cout << tmp[k] << endl;
- return;*/
- }
- else if (i == )
- {
- for (int k = , m = ; k < , m < ; ++k, ++m)
- {
- for (int j = , n = ; j < , n < ; j += , ++n)
- temp.maze[m][n] = tmp[k][j];
- }
- temp = cclockwise(temp);
- for (int k = , m = ; k < , m < ; ++k, ++m)
- {
- for (int j = , n = ; j < , n < ; j += , ++n)
- tmp[k][j] = temp.maze[m][n];
- }
- char cpy[][];
- memcpy(cpy, tmp, sizeof(cpy));
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- memcpy(tmp, cpy, sizeof(tmp));
- /*for (int k = 0; k < 9; ++k)
- cout << tmp[k] << endl;
- return;*/
- }
- else if (i == )
- {
- for (int k = , m = ; k < , m < ; ++k, ++m)
- {
- for (int j = , n = ; j < , n < ; j += , ++n)
- temp.maze[m][n] = tmp[k][j];
- }
- temp = clockwise(temp);
- for (int k = , m = ; k < , m < ; ++k, ++m)
- {
- for (int j = , n = ; j < , n < ; j += , ++n)
- tmp[k][j] = temp.maze[m][n];
- }
- char cpy[][];
- memcpy(cpy, tmp, sizeof(cpy));
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- memcpy(tmp, cpy, sizeof(tmp));
- /*for (int k = 0; k < 9; ++k)
- cout << tmp[k] << endl;
- return;*/
- }
- else if (i == )
- {
- for (int k = , m = ; k < , m < ; ++k, ++m)
- {
- for (int j = , n = ; j < , n < ; j += , ++n)
- temp.maze[m][n] = tmp[k][j];
- }
- temp = cclockwise(temp);
- for (int k = , m = ; k < , m < ; ++k, ++m)
- {
- for (int j = , n = ; j < , n < ; j += , ++n)
- tmp[k][j] = temp.maze[m][n];
- }
- char cpy[][];
- memcpy(cpy, tmp, sizeof(cpy));
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- memcpy(tmp, cpy, sizeof(tmp));
- /*for (int k = 0; k < 9; ++k)
- cout << tmp[k] << endl;
- return;*/
- }
- else if (i == )
- {
- for (int k = , m = ; k < , m < ; ++k, ++m)
- {
- for (int j = , n = ; j < , n < ; j += , ++n)
- temp.maze[m][n] = tmp[k][j];
- }
- temp = clockwise(temp);
- for (int k = , m = ; k < , m < ; ++k, ++m)
- {
- for (int j = , n = ; j < , n < ; j += , ++n)
- tmp[k][j] = temp.maze[m][n];
- }
- char cpy[][];
- memcpy(cpy, tmp, sizeof(cpy));
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- memcpy(tmp, cpy, sizeof(tmp));
- /*for (int k = 0; k < 9; ++k)
- cout << tmp[k] << endl;
- return;*/
- }
- else if (i == )
- {
- for (int k = , m = ; k < , m < ; ++k, ++m)
- {
- for (int j = , n = ; j < , n < ; j += , ++n)
- temp.maze[m][n] = tmp[k][j];
- }
- temp = cclockwise(temp);
- for (int k = , m = ; k < , m < ; ++k, ++m)
- {
- for (int j = , n = ; j < , n < ; j += , ++n)
- tmp[k][j] = temp.maze[m][n];
- }
- char cpy[][];
- memcpy(cpy, tmp, sizeof(cpy));
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- memcpy(tmp, cpy, sizeof(tmp));
- /*for (int k = 0; k < 9; ++k)
- cout << tmp[k] << endl;
- return;*/
- }
- else if (i == )
- {
- for (int k = , m = ; k < , m < ; ++k, ++m)
- {
- for (int j = , n = ; j < , n < ; j += , ++n)
- temp.maze[m][n] = tmp[k][j];
- }
- temp = clockwise(temp);
- for (int k = , m = ; k < , m < ; ++k, ++m)
- {
- for (int j = , n = ; j < , n < ; j += , ++n)
- tmp[k][j] = temp.maze[m][n];
- }
- char cpy[][];
- memcpy(cpy, tmp, sizeof(cpy));
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- memcpy(tmp, cpy, sizeof(tmp));
- /*for (int k = 0; k < 9; ++k)
- cout << tmp[k] << endl;
- return;*/
- }
- else if (i == )
- {
- for (int k = , m = ; k < , m < ; ++k, ++m)
- {
- for (int j = , n = ; j < , n < ; j += , ++n)
- temp.maze[m][n] = tmp[k][j];
- }
- temp = cclockwise(temp);
- for (int k = , m = ; k < , m < ; ++k, ++m)
- {
- for (int j = , n = ; j < , n < ; j += , ++n)
- tmp[k][j] = temp.maze[m][n];
- }
- char cpy[][];
- memcpy(cpy, tmp, sizeof(cpy));
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- memcpy(tmp, cpy, sizeof(tmp));
- /*for (int k = 0; k < 9; ++k)
- cout << tmp[k] << endl;
- return;*/
- }
- else if (i == )
- {
- for (int k = , m = ; k < , m < ; ++k, ++m)
- {
- for (int j = , n = ; j < , n < ; j += , ++n)
- temp.maze[m][n] = tmp[k][j];
- }
- temp = clockwise(temp);
- for (int k = , m = ; k < , m < ; ++k, ++m)
- {
- for (int j = , n = ; j < , n < ; j += , ++n)
- tmp[k][j] = temp.maze[m][n];
- }
- char cpy[][];
- memcpy(cpy, tmp, sizeof(cpy));
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- memcpy(tmp, cpy, sizeof(tmp));
- /*for (int k = 0; k < 9; ++k)
- cout << tmp[k] << endl;
- return;*/
- }
- else if (i == )
- {
- for (int k = , m = ; k < , m < ; ++k, ++m)
- {
- for (int j = , n = ; j < , n < ; j += , ++n)
- temp.maze[m][n] = tmp[k][j];
- }
- temp = cclockwise(temp);
- for (int k = , m = ; k < , m < ; ++k, ++m)
- {
- for (int j = , n = ; j < , n < ; j += , ++n)
- tmp[k][j] = temp.maze[m][n];
- }
- char cpy[][];
- memcpy(cpy, tmp, sizeof(cpy));
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- cpy[][] = tmp[][];
- memcpy(tmp, cpy, sizeof(tmp));
- /*for (int k = 0; k < 9; ++k)
- cout << tmp[k] << endl;
- return;*/
- }
- /*if (i == 1 && deep == 2)
- {
- cout << "first" << endl;
- for (int k = 0; k < 9; ++k)
- cout << tmp[k] << endl;
- }
- if (i == 2 && deep == 2)
- {
- cout << "second" << endl;
- for (int k = 0; k < 9; ++k)
- cout << tmp[k] << endl;
- }*/
- dfs(rec + , tmp, deep);
- //if (i == 1) return;
- if (bol)
- {
- P[rec].first = i / ;
- if (i % == ) P[rec].second = ;
- else P[rec].second = -;
- return;
- }
- }
- }
- int main()
- {
- int T;
- cin >> T;
- while (T--)
- {
- string nul;
- getline(cin, nul);
- for (int i = ; i < ; ++i)
- {
- char ss;
- int num = ;
- while ((ss = getchar()) != '\n')
- {
- if (ss != ' ') cube[i][num++] = ss;
- else cube[i][num++] = ' ';
- }
- cube[i][num] = '\0';
- }
- /*for (int i = 0; i < 9; ++i)
- cout << cube[i] << endl;*/
- /*for (int i = 0; i < 3; ++i)
- {
- for (int j = 6; j < 11; j += 2)
- {
- cout << cube[i][j] << ' ';
- }
- cout << endl;
- }*/
- /*cur gat;
- memcpy(gat.maze, cube, sizeof(gat.maze));
- int p = judge(gat);
- cout << p << endl;*/
- bol = , ans = ;
- for (int i = ; i <= ; ++i)
- {
- //cout << "deep:" << i << endl;
- dfs(, cube, i);
- if (bol)
- {
- print();
- break;
- }
- }
- if (!bol) cout << - << endl;
- }
- return ;
- }
ZOJ2477 Magic Cube的更多相关文章
- ZOJ 2477 Magic Cube(魔方)
ZOJ 2477 Magic Cube(魔方) Time Limit: 2 Seconds Memory Limit: 65536 KB This is a very popular gam ...
- ZOJ 2477 Magic Cube 暴力,模拟 难度:0
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1477 用IDA*可能更好,但是既然时间宽裕数据简单,而且记录状态很麻烦,就直接 ...
- magic cube
搜索题, 每个状态能扩展出12种状态,最多进行5次旋转12^5 要用到iddfs,或者我看到网上其他人用的ida* 我也是参考了别人的代码,而且这个题vj上有点问题,我看数据看了半天,愣是没看明白第二 ...
- 2019杭电多校二 F. Fantastic Magic Cube (FWT)
大意: 给定$N^3$立方体, 每个单位立方体权值为三个坐标异或, 每次沿坐标轴切一刀, 得分为两半内权值和的乘积, 求切成$n^3$块的最大得分. 可以发现得分与切法无关, 假设每个点权值为$a_i ...
- sdutoj 2606 Rubik’s cube
http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2606 Rubik’s cube Time Li ...
- USACO 3.2 Magic Squares
Magic SquaresIOI'96 Following the success of the magic cube, Mr. Rubik invented its planar version, ...
- 用DirectX实现魔方(一)
关于魔方 魔方英文名字叫做Rubik's Cube,是由匈牙利建筑学教授和雕塑家Ernő Rubik于1974年发明,最初叫做Magic Cube(这大概也是中文名字的来历吧),1980年Ideal ...
- 一位学长的ACM总结(感触颇深)
发信人: fennec (fennec), 信区: Algorithm 标 题: acm 总结 by fennec 发信站: 吉林大学牡丹园站 (Wed Dec 8 16:27:55 2004) AC ...
- ZOJ - 2477 dfs [kuangbin带你飞]专题二
注意输入的处理,旋转操作打表.递增枚举可能步数,作为限制方便找到最短路. AC代码:90ms #include<cstdio> #include<cstring> char m ...
随机推荐
- HDU_1068_Girls and Boys_二分图匹配
Girls and Boys Time Limit: 20000/10000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
- js中关于new Object时传参的一些细节分析
1, 参数是一个对象,核心js对象(native ECMAScript object)或宿主对象(host object),那么将直接返回该对象. 其生成的对象构造器仍然是所传参数对象的构造器.这样造 ...
- 2.Linux的用户、用户组、权限、文件系统管理及其网络配置
2.1 Linux的用户及用户组 2.1.1 Linux的用户管理 用户账号管理包含以下三个方面: 用户账号的添加.删除.与修改 用户口令(密码)的管理 用户组的添加.删除管理 Linux系统中用户信 ...
- PHP服务搭建
一.PHP二进制安装(下载路径http://cn2.php.net/get/php-5.5.32.tar.gz/from/a/mirror) 1.解压: tar xf php-5.5.32.tar.g ...
- ORM 操作
官方文档 一.操作 基本操作 # 增 models.Tb1.objects.create(c1='xx', c2='oo') # 增加一条数据,可以接受字典类型数据 **kwargs obj = mo ...
- python最好用的IDE及查看源码的方法
一.PyCharm 很多语言都有比较流行的开发工具,比如JAVA 的Eclipse, C#,C++的VisualStudio,最好的Python 开发IDE就是PyCharm 可以直接调试代码,试运行 ...
- 【模板】非旋转Treap
Treap,也叫做树堆,是指有一个随机附加域满足堆的性质的二叉搜索树. 如果一棵二叉搜索树插入节点的顺序是随机的,那我们得到的二叉搜索树在大多数情况下是平衡的,期望高度是log(n). 但有些情况下我 ...
- BZOJ 1724 USACO 2006 Nov. 切割木板
倒过来的合并果子? 做法与合并果子一样 维护一个小根堆,每次取出最小的两个数进行合并 #include<cstdio> #include<algorithm> #include ...
- 绿色地址栏扩展验证(EV)SSL证书、支持SGC 强制最低128位
Pro With EV SSL证书,最严格的域名所有权和企业身份信息验证,属于最高信任级别.最高安全级别的 EV SSL证书,该证书可以使地址栏变成高安全绿色,并且在地址栏内显示您公司的名称,提高 ...
- BUPT2017 springtraining(16) #2 ——基础数据结构
题目在这里 A.似乎是个并查集+??? B.10W的范围,似乎可以暴力来一发二分+sort? 但我猜正解可以O(nlogn)? C.单调队列入门题目 #include <cstdio> ] ...