好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

SRM630DIV2_html/css_WEB-ITnose

SRM 630 DIV2

第一次TC,本来以为AK了,结果1000分还是被系统cha掉了,不过倒是也cha掉了房间其他人赚了不少

A:字符串长度才50,直接简单的模拟即可
B:结点个数才10,先做一边floyd,找出两两之间路径,然后暴力枚举选哪些点,判断可不可以,如果可以的话,记录下最大个数
C:一开始的做法是,构造出rank数组后,对于连续的一段,都放a,然后最后一个放b即可,以为这样构造出来的肯定是字典序最小的,结果被系统cha掉了。
正确做法:一开始先构造出sa数组,暴力枚举每个位置,非'a'的,只要减1,保证字典序小了,在去构造一下sa数组,判断一下两个后缀数组一不一样,如果所有位置都不一样,说明这个是字典序最小的

代码:

A:

#include  #include  #include  #include  #include  #include  #include  using namespace std;class DoubleLetter {    public:	string ableToSolve(string S) {	    while (1) {		int n = S.length();		string tmp = "";		int flag = 1;		for (int i = 0; i  

B:

#include  #include  #include  #include  #include using namespace std;class Egalitarianism3Easy {public:    int bitcount(int x) {	int ans = 0;	while (x) {	    ans += (x&1);	    x >>= 1;	}	return ans;    }    int maxCities(int n, vector  a, vector  b, vector  len) {	int g[15][15];	for (int i = 1; i  

C:

#include  #include  #include  #include using namespace std;typedef pair  pii;class SuffixArrayDiv2 {    public:    string smallerOne(string s) {	int n = s.length();	pii save[55];	for (int i = n - 1; i >= 0; i--) {	    string tmp = "";	    for (int j = i; j  = 0; i--) {		string tmp = "";		for (int j = i; j  

查看更多关于SRM630DIV2_html/css_WEB-ITnose的详细内容...

  阅读:34次