Lang:GCC
Edit12345678910111213141516171819202122232425262728293031#include <stdio.h>#define MAXN 20000#define MAX_LENGTH 30/* uses trie tree */struct {int next[26 + 10 + 1];int data;} Last_visit[MAXN * MAX_LENGTH];int tree_end = 1;char url[MAX_LENGTH + 1];/* projection[i] stores the index in Last_visit[] of a[i] */int projection[MAXN + 1];int code_of[128];void init() {int i;for (i = '0'; i <= '9'; ++i)code_of[i] = i - '0' + 26;for (i = 'a'; i <= 'z'; ++i)code_of[i] = i - 'a';code_of['.'] = 26 + 10;}/* x is the index in a[], initial value is 0 if not set */int* get(int x) {if (projection[x] == 0) {int index = 0, i, code;for (i = 0; url[i]; ++i) {