本文整理汇总了C++中trie::parse_input方法的典型用法代码示例。如果您正苦于以下问题:C++ trie::parse_input方法的具体用法?C++ trie::parse_input怎么用?C++ trie::parse_input使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类trie
的用法示例。
在下文中一共展示了trie::parse_input方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
cout<<"KOAKSODKASdokasdo\n";
_trie = trie();
for (int i = 0; i < 500100; i++)
finished [i] = turns_into [i] = -1;
scanf ("%d", &n); getchar();
for (int i = 0; i < n; i++)
_trie.parse_input();
for (int i = 0; i < words.size(); i++)
printf ("%d ", words [i]); printf ("\n");
scanf ("%d", &m); getchar();
for (int i = 0; i < m; i++)
{
int X = _trie.parse_input();
int Y = _trie.parse_input();
printf ("%d %d\n", X, Y);
turns_into[X] = Y;
cool [X] = true;
QMAX = max (X, Y);
}
QMAX = max (QMAX, word_index);
int R = 0, L = 0;
for (int i = 0; i < words.size(); i)
{
if (turns_into [words [i]] == -1)
{
R += R_count [words [i]];
L += lengths [words [i]];
}
else if (finished [words [i]])
{
R += R_count [words [i]];
L += lengths [words [i]];
}
else
{
stacks.clear();
int current_index = words [i];
int q = i - 1;
while (finished [current_index] != -1)
{
stacks.push_back(current_index);
finished[current_index] = 1;
current_index = turns_into [current_index];
}
stacks.push_back(current_index);
int MAXR = R_count[current_index];
int MAXL = lengths[current_index];
for (int j = stacks.size() - 2; j > -1; j--)
{
if (R_count [stacks [j]] == R_count [stacks [j - 1]])
{
R_count[stacks [j]] = R_count[stacks [j + 1]];
}
}
}
}
return 0;
}