摘要:
彩笔的发现:(1)动态trie超时。(2)要保证OJ输入的原子性,不可中途随意break掉。(3)memset过大的数组也挺耗时的。#include <stdio.h>#include <string.h>#define BRANCH 1#define LEAF 0const int MAXN = 10;const int MAXLEN = 20;const int NIL = 0;typedef struct { int type; int count; int next[MAXN];}NODE;int root;NODE trie[1000000];int cnt; 阅读全文
摘要:
#include <stdio.h>#include <string.h>#include <stdlib.h>#define BRANCH 1#define LEAF 0const int MAXN = 256;const int MAXLEN = 10000;typedef struct NODE { int type; int count; struct NODE* next[MAXN];}NODE;NODE root;char buffer[MAXLEN];int pos;void INSERT(const char* s){ NODE* curr; 阅读全文