Exemple #1
0
	int run_test_case( int casenum ) {
		switch( casenum ) {
		case 0: {
			string words[]            = {"hello","hi","h","run","rerun","running"};
			int expected              = 4;

			return verify_case( casenum, expected, PrefixFreeSets().maxElements( vector <string>( words, words + ( sizeof words / sizeof words[0] ) ) ) );
		}
		case 1: {
			string words[]            = {"a","b","cba","cbc","cbb","ccc"};
			int expected              = 6;

			return verify_case( casenum, expected, PrefixFreeSets().maxElements( vector <string>( words, words + ( sizeof words / sizeof words[0] ) ) ) );
		}
		case 2: {
			string words[]            = {"a","ab","abc","abcd","abcde","abcdef"};
			int expected              = 1;

			return verify_case( casenum, expected, PrefixFreeSets().maxElements( vector <string>( words, words + ( sizeof words / sizeof words[0] ) ) ) );
		}
		case 3: {
			string words[]            = {"topcoder","topcoder","topcoding"};
			int expected              = 2;

			return verify_case( casenum, expected, PrefixFreeSets().maxElements( vector <string>( words, words + ( sizeof words / sizeof words[0] ) ) ) );
		}

		// custom cases

/*      case 4: {
			string words[]            = ;
			int expected              = ;

			return verify_case( casenum, expected, PrefixFreeSets().maxElements( vector <string>( words, words + ( sizeof words / sizeof words[0] ) ) ) );
		}*/
/*      case 5: {
			string words[]            = ;
			int expected              = ;

			return verify_case( casenum, expected, PrefixFreeSets().maxElements( vector <string>( words, words + ( sizeof words / sizeof words[0] ) ) ) );
		}*/
/*      case 6: {
			string words[]            = ;
			int expected              = ;

			return verify_case( casenum, expected, PrefixFreeSets().maxElements( vector <string>( words, words + ( sizeof words / sizeof words[0] ) ) ) );
		}*/
		default:
			return -1;
		}
	}
Exemple #2
0
    int run_test_case(int casenum__) {
        switch (casenum__) {
            case 0: {
                        string words[]            = {"hello","hi","h","run","rerun","running"};
                        int expected__            = 4;

                        clock_t start__           = clock();
                        int received__            = PrefixFreeSets().maxElements(vector <string>(words, words + (sizeof words / sizeof words[0])));
                        return verify_case(casenum__, expected__, received__, clock()-start__);
                    }
            case 1: {
                        string words[]            = {"a","b","cba","cbc","cbb","ccc"};
                        int expected__            = 6;

                        clock_t start__           = clock();
                        int received__            = PrefixFreeSets().maxElements(vector <string>(words, words + (sizeof words / sizeof words[0])));
                        return verify_case(casenum__, expected__, received__, clock()-start__);
                    }
            case 2: {
                        string words[]            = {"a","ab","abc","abcd","abcde","abcdef"};
                        int expected__            = 1;

                        clock_t start__           = clock();
                        int received__            = PrefixFreeSets().maxElements(vector <string>(words, words + (sizeof words / sizeof words[0])));
                        return verify_case(casenum__, expected__, received__, clock()-start__);
                    }
            case 3: {
                        string words[]            = {"topcoder","topcoder","topcoding"};
                        int expected__            = 2;

                        clock_t start__           = clock();
                        int received__            = PrefixFreeSets().maxElements(vector <string>(words, words + (sizeof words / sizeof words[0])));
                        return verify_case(casenum__, expected__, received__, clock()-start__);
                    }

                    // custom cases

                    /*      case 4: {
                            string words[]            = ;
                            int expected__            = ;

                            clock_t start__           = clock();
                            int received__            = PrefixFreeSets().maxElements(vector <string>(words, words + (sizeof words / sizeof words[0])));
                            return verify_case(casenum__, expected__, received__, clock()-start__);
                            }*/
                    /*      case 5: {
                            string words[]            = ;
                            int expected__            = ;

                            clock_t start__           = clock();
                            int received__            = PrefixFreeSets().maxElements(vector <string>(words, words + (sizeof words / sizeof words[0])));
                            return verify_case(casenum__, expected__, received__, clock()-start__);
                            }*/
                    /*      case 6: {
                            string words[]            = ;
                            int expected__            = ;

                            clock_t start__           = clock();
                            int received__            = PrefixFreeSets().maxElements(vector <string>(words, words + (sizeof words / sizeof words[0])));
                            return verify_case(casenum__, expected__, received__, clock()-start__);
                            }*/
            default:
                    return -1;
        }
    }