zoukankan      html  css  js  c++  java
  • poj 3630(Phone List )

    http://poj.org/problem?id=3630

        很无奈的又一次验证了poj数据弱爆的真理!hdoj用STL根本水不过去,一直是TLE,poj则一下水过....

        今天先这样了,明天再用字典树来试一下。

    #include <iostream>
    #include <string>
    #include <vector>
    #include <algorithm>
    using namespace std ;

    int main(){
        vector<string> v ;
        string s ;
        int n ;
        cin >> n ;
        int i, b ;
        while (cin >> n){
            b = 0 ;
            v.clear() ;
            for (i=0; i<n; i++){
                cin >> s ;
                v.push_back(s) ;
            }
            sort(v.begin(), v.end()) ;
            for (i=0; i<n-1; ++i){
                if (v[i+1].find(v[i]) == 0){
                    cout << "NO" << endl ;
                    b=1 ;   break ;
                }
            }
            if(b==0)    cout << "YES" << endl ;
        }
        return 0 ;
    }
  • 相关阅读:
    php去除数组中重复值,并返回结果!
    SignalR 2 入门
    SignalR支持的平台
    SignalR简介
    作业调度系统quartz.net
    Oracle安装心得
    maven的项目目录解析
    web.xml的<url-parttern>的匹配规则
    Web.xml中四种验证方式
    Web.xml
  • 原文地址:https://www.cnblogs.com/xiaolongchase/p/2208000.html
Copyright © 2011-2022 走看看