hihoCoder太阁最新面经算法竞赛19 register

Ended

Participants:128

Verdict:Accepted
Score:100 / 100
Submitted:2016-12-20 14:38:40

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <iostream>
#include <vector>
#include <cstdio>
#include <queue>
#include <string>
#include <cstring>
using namespace std;
vector<string> wset;
queue<int> posq[27];
const int maxn=100003;
string ss;
int succt[maxn][27];
bool match(string &cs){
    int pos = 0;
    for (int i = 0 ; i < cs.length(); i++){
        int ch = cs[i] - 'a';
        if(succt[pos][ch] != -1){
            pos = succt[pos][cs[i]-'a'];
        } else{
            return false;
        }
    }
    return true;
}
int main(){
    int n;
    cin>>n;
    string s;
    for (int i = 0; i < n; i++){
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX