Submission #330408

# Submission time Handle Problem Language Result Execution time Memory
330408 2020-11-25T07:14:46 Z Azert Type Printer (IOI08_printer) C++14
0 / 100
74 ms 117996 KB
#include <bits/stdc++.h>
using namespace std;

const int N = 1e6 + 5;
int nnode;
int trie[N][30];


void add(string a) {
    int cur = 0;
    for (int i = 0; i < a.size(); i++) {
        if (trie[cur][a[i] - 'a'] == -1) {
            trie[cur][a[i] - 'a'] = ++nnode;
        }
        cur = trie[cur][a[i] - 'a'];
    }
}

int main() {
    int n, m = 0;
    scanf("%d", &n);
    string tmp;
    memset(trie, -1, sizeof(trie));
    for (int i = 1; i <= n; i++) {
        cin >> tmp;
        m = max(m, (int)tmp.size());
        add(tmp);
    }
    // cout << nnode << "\n";
    printf("%d\n", 2 * nnode + n - m);
}

Compilation message

printer.cpp: In function 'void add(std::string)':
printer.cpp:11:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |     for (int i = 0; i < a.size(); i++) {
      |                     ~~^~~~~~~~~~
printer.cpp: In function 'int main()':
printer.cpp:21:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   21 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 64 ms 117868 KB Line "" doesn't correspond to pattern "[a-z\-P]{1}"
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 64 ms 117740 KB Line "" doesn't correspond to pattern "[a-z\-P]{1}"
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 65 ms 117888 KB Line "" doesn't correspond to pattern "[a-z\-P]{1}"
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 64 ms 117740 KB Line "" doesn't correspond to pattern "[a-z\-P]{1}"
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 62 ms 117740 KB Line "" doesn't correspond to pattern "[a-z\-P]{1}"
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 62 ms 117740 KB Line "" doesn't correspond to pattern "[a-z\-P]{1}"
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 63 ms 117888 KB Line "" doesn't correspond to pattern "[a-z\-P]{1}"
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 66 ms 117848 KB Line "" doesn't correspond to pattern "[a-z\-P]{1}"
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 71 ms 117996 KB Line "" doesn't correspond to pattern "[a-z\-P]{1}"
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 74 ms 117996 KB Line "" doesn't correspond to pattern "[a-z\-P]{1}"
2 Halted 0 ms 0 KB -