#include <iostream>
#include <vector>
#include <string>
#define MAXN 25000
using namespace std;
struct Trie {
int nex[26]; // index of next trie for each letter
int prev; // parent
bool end; // end of a word
Trie() {
fill(nex, nex + 26, -1);
prev = -1;
end = false;
}
};
Trie tries[MAXN * 20 + 5];
int N;
char letters[200]; // store letter for each ascii value
int index = 1;
int wc = 0; //word count
void traverse(int curr) {
for (int c = 0; c < 26; c++) { // loop through each letter
if (tries[curr].nex[c] != -1) {
cout << letters[c] << endl;
traverse(tries[curr].nex[c]);
if (wc == N) return;
cout << "-" << endl;
}
}
if (tries[curr].end) {
cout << "P" << endl;
wc++;
}
return;
}
int main() {
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
21 ms |
55040 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
21 ms |
54972 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
21 ms |
54980 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
21 ms |
54996 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
21 ms |
54996 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
23 ms |
54940 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
54972 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
55008 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
54944 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
25 ms |
55048 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |