# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
529875 | 2022-02-23T23:05:28 Z | luanaamorim | Type Printer (IOI08_printer) | C++14 | 417 ms | 17984 KB |
#include <iostream> #include <queue> #include <string> #include <algorithm> #include <vector> #include <cmath> #include <iomanip> #include <map> #include <cstring> #include <set> #include <stack> #include <bitset> #define ll long long #define INF (1e9) #define MAX (int) (2e5 + 5) #define MOD 1000000007 #define par pair<int, int> #define all(v) v.begin(), v.end() #define sz(x) (int) ((x).size()) #define esq(x) (x<<1) #define dir(x) ((x<<1)|1) #define lsb(x) (x & -x) #define W(x) cout << #x << ": " << x << endl #define Wii(x) cout << x.first << ' ' << x.second << endl #define _ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); using namespace std; int n, t[MAX], trie[MAX][26], qnt, tot; string s; void add(string s) { int u = 0; for (char c : s) { c -= 'a'; if (!trie[u][c]) trie[u][c] = ++qnt; u = trie[u][c]; } t[u] = 1; } void solve(int u, char c) { if (u) cout << c << endl; if (t[u]) { cout << "P" << endl; ++tot; } for (int i = 0; i < 26; i++) { if (!trie[u][i]) continue; solve(trie[u][i], i+'a'); if (tot != n) cout << "-" << endl; } } int main() {_ cin >> n; for (int i = 0; i < n; i++) { cin >> s; add(s); } solve(0, ' '); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 332 KB | Expected integer, but "t" found |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 332 KB | Expected integer, but "e" found |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 332 KB | Expected integer, but "h" found |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 332 KB | Expected integer, but "b" found |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 332 KB | Expected integer, but "a" found |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 18 ms | 1080 KB | Expected integer, but "a" found |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 61 ms | 3012 KB | Expected integer, but "a" found |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 203 ms | 7276 KB | Expected integer, but "a" found |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 417 ms | 17984 KB | Expected integer, but "a" found |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 353 ms | 14180 KB | Expected integer, but "a" found |
2 | Halted | 0 ms | 0 KB | - |