Task: | Buzzwords |
Sender: | MallocManfred |
Submission time: | 2024-11-04 17:35:48 +0200 |
Language: | C++ (C++11) |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.00 s | details |
#2 | WRONG ANSWER | 0.00 s | details |
#3 | WRONG ANSWER | 0.00 s | details |
#4 | WRONG ANSWER | 0.00 s | details |
#5 | WRONG ANSWER | 0.00 s | details |
#6 | WRONG ANSWER | 0.00 s | details |
#7 | WRONG ANSWER | 0.00 s | details |
#8 | WRONG ANSWER | 0.00 s | details |
#9 | WRONG ANSWER | 0.00 s | details |
#10 | WRONG ANSWER | 0.00 s | details |
#11 | WRONG ANSWER | 0.00 s | details |
#12 | WRONG ANSWER | 0.00 s | details |
#13 | WRONG ANSWER | 0.00 s | details |
#14 | WRONG ANSWER | 0.00 s | details |
#15 | WRONG ANSWER | 0.00 s | details |
#16 | WRONG ANSWER | 0.00 s | details |
#17 | WRONG ANSWER | 0.00 s | details |
#18 | WRONG ANSWER | 0.00 s | details |
#19 | WRONG ANSWER | 0.00 s | details |
#20 | WRONG ANSWER | 0.00 s | details |
#21 | WRONG ANSWER | 0.00 s | details |
#22 | WRONG ANSWER | 0.00 s | details |
#23 | WRONG ANSWER | 0.00 s | details |
#24 | WRONG ANSWER | 0.00 s | details |
#25 | WRONG ANSWER | 0.00 s | details |
#26 | WRONG ANSWER | 0.00 s | details |
#27 | WRONG ANSWER | 0.00 s | details |
#28 | WRONG ANSWER | 0.00 s | details |
#29 | WRONG ANSWER | 0.00 s | details |
#30 | WRONG ANSWER | 0.00 s | details |
#31 | WRONG ANSWER | 0.00 s | details |
#32 | WRONG ANSWER | 0.00 s | details |
#33 | WRONG ANSWER | 0.00 s | details |
#34 | WRONG ANSWER | 0.00 s | details |
#35 | WRONG ANSWER | 0.00 s | details |
#36 | WRONG ANSWER | 0.00 s | details |
#37 | WRONG ANSWER | 0.00 s | details |
#38 | WRONG ANSWER | 0.00 s | details |
#39 | WRONG ANSWER | 0.00 s | details |
#40 | WRONG ANSWER | 0.00 s | details |
#41 | WRONG ANSWER | 0.00 s | details |
#42 | WRONG ANSWER | 0.00 s | details |
#43 | WRONG ANSWER | 0.00 s | details |
#44 | WRONG ANSWER | 0.00 s | details |
Compiler report
input/code.cpp: In constructor 'Node::Node()': input/code.cpp:39:23: warning: iteration 26 invokes undefined behavior [-Waggressive-loop-optimizations] 39 | letter[i] = NULL; | ^ input/code.cpp:6:38: note: within this loop 6 | #define REP(i,a,b) for (int i = a; i <= b; i++) | ^ input/code.cpp:38:9: note: in expansion of macro 'REP' 38 | REP(i, 0, 26) { | ^~~
Code
#include <bits/stdc++.h> using namespace std; #define int long long #define vout(x) for(int i=0;i<(long long)x.size();i++) printf("%lld ",x[i]); #define REP(i,a,b) for (int i = a; i <= b; i++) // g++ <filename>.cpp -g -Wall -Wextra -DDEBUG -o <executable> // copied from: https://codeforces.com/blog/entry/79024 // === Debug macro starts here === int recur_depth = 0; #ifdef DEBUG #define dbg(x) {++recur_depth; auto x_=x; --recur_depth; cerr<<string(recur_depth, '\t')<<"\e[91m"<<__func__<<":"<<__LINE__<<"\t"<<#x<<" = "<<x_<<"\e[39m"<<endl;} #else #define dbg(x) #endif template<typename Ostream, typename Cont> typename enable_if<is_same<Ostream,ostream>::value, Ostream&>::type operator<<(Ostream& os, const Cont& v){ os<<"["; for(auto& x:v){os<<x<<", ";} return os<<"]"; } template<typename Ostream, typename ...Ts> Ostream& operator<<(Ostream& os, const pair<Ts...>& p){ return os<<"{"<<p.first<<", "<<p.second<<"}"; } // === Debug macro ends here === struct Node { Node *letter[26]; bool end; Node() { end = false; REP(i, 0, 26) { letter[i] = NULL; } } }; void insert(Node *root, string &s) { Node *current = root; for (auto c : s) { if (current->letter[c - 'a'] == NULL) { Node *node = new Node(); current->letter[c - 'a'] = node; } current = current->letter[c - 'a']; } current->end = true; } bool search(Node *root, string &s) { Node *current = root; for (auto c : s) { dbg(c); if (current->letter[c - 'a'] == NULL) { return false; } current = current->letter[c - 'a']; } return current->end; } signed main() { int q; string s; getline(cin, s); cin >> q; Node *root = new Node(); for (int i = 0; i < 1; i++) { string bw; cin >> bw; insert(root, bw); } stringstream s_stream(s); string word; int cnt = 0; while(s_stream >> word) { // dbg(search(root, word)) if (search(root, word)) cnt++; } cout << cnt << "\n"; return 0; }
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
g fhe 395 a aa aafh ... |
correct output |
---|
10 |
user output |
---|
0 |
Test 2
Verdict: WRONG ANSWER
input |
---|
s adh 372 a ad ae ... |
correct output |
---|
6 |
user output |
---|
0 |
Test 3
Verdict: WRONG ANSWER
input |
---|
adcdb 20 a aa ab ... |
correct output |
---|
9 |
user output |
---|
0 |
Test 4
Verdict: WRONG ANSWER
input |
---|
aaaaa 5 a aa aaa ... |
correct output |
---|
15 |
user output |
---|
0 |
Test 5
Verdict: WRONG ANSWER
input |
---|
o zws 759 a ab abw ... |
correct output |
---|
8 |
user output |
---|
0 |
Test 6
Verdict: WRONG ANSWER
input |
---|
aaaaa 5 a aa aaa ... |
correct output |
---|
15 |
user output |
---|
0 |
Test 7
Verdict: WRONG ANSWER
input |
---|
ifv b 649 a aaw ac ... |
correct output |
---|
10 |
user output |
---|
0 |
Test 8
Verdict: WRONG ANSWER
input |
---|
dbbdc 129 a aa aaab ... |
correct output |
---|
15 |
user output |
---|
0 |
Test 9
Verdict: WRONG ANSWER
input |
---|
aaaaa 5 a aa aaa ... |
correct output |
---|
15 |
user output |
---|
0 |
Test 10
Verdict: WRONG ANSWER
input |
---|
eeeab 9 a b c ... |
correct output |
---|
5 |
user output |
---|
0 |
Test 11
Verdict: WRONG ANSWER
input |
---|
ghfhe d fd 430 a aa aafa ... |
correct output |
---|
22 |
user output |
---|
0 |
Test 12
Verdict: WRONG ANSWER
input |
---|
syadhzdgck 275 a ad adh ... |
correct output |
---|
53 |
user output |
---|
0 |
Test 13
Verdict: WRONG ANSWER
input |
---|
adcdbbbbba 256 a aa aaa ... |
correct output |
---|
49 |
user output |
---|
0 |
Test 14
Verdict: WRONG ANSWER
input |
---|
aaaaaaaaaa 10 a aa aaa ... |
correct output |
---|
55 |
user output |
---|
0 |
Test 15
Verdict: WRONG ANSWER
input |
---|
o zwspspfd 468 a adks afhsrhvwxn ... |
correct output |
---|
45 |
user output |
---|
0 |
Test 16
Verdict: WRONG ANSWER
input |
---|
aaaaaaaaaa 10 a aa aaa ... |
correct output |
---|
55 |
user output |
---|
0 |
Test 17
Verdict: WRONG ANSWER
input |
---|
i vbbjczpc 703 a aa abou ... |
correct output |
---|
29 |
user output |
---|
0 |
Test 18
Verdict: WRONG ANSWER
input |
---|
d bdcbdbcb 128 a aa aab ... |
correct output |
---|
42 |
user output |
---|
0 |
Test 19
Verdict: WRONG ANSWER
input |
---|
aaaaaaaaaa 10 a aa aaa ... |
correct output |
---|
55 |
user output |
---|
0 |
Test 20
Verdict: WRONG ANSWER
input |
---|
eeeabcbabh 171 a aac aahg ... |
correct output |
---|
34 |
user output |
---|
0 |
Test 21
Verdict: WRONG ANSWER
input |
---|
ghfhehdf ddciaicdehheefdihadaf... |
correct output |
---|
246 |
user output |
---|
0 |
Test 22
Verdict: WRONG ANSWER
input |
---|
s adhzdgckekirkyowkirnflwfanrx... |
correct output |
---|
52 |
user output |
---|
0 |
Test 23
Verdict: WRONG ANSWER
input |
---|
adcdbbbbbaaccabbbccd cabccacdb... |
correct output |
---|
178 |
user output |
---|
0 |
Test 24
Verdict: WRONG ANSWER
input |
---|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... |
correct output |
---|
2518 |
user output |
---|
0 |
Test 25
Verdict: WRONG ANSWER
input |
---|
oezws spfdzfasgxlquafowjzpe pv... |
correct output |
---|
284 |
user output |
---|
0 |
Test 26
Verdict: WRONG ANSWER
input |
---|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... |
correct output |
---|
1387 |
user output |
---|
0 |
Test 27
Verdict: WRONG ANSWER
input |
---|
ifvbbjczpcnpknimqvlttkngpe szx... |
correct output |
---|
258 |
user output |
---|
0 |
Test 28
Verdict: WRONG ANSWER
input |
---|
dbbdcbdb bcaabb bccddbbbacbcdc... |
correct output |
---|
36 |
user output |
---|
0 |
Test 29
Verdict: WRONG ANSWER
input |
---|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... |
correct output |
---|
3076 |
user output |
---|
0 |
Test 30
Verdict: WRONG ANSWER
input |
---|
e eabcbabhdbcbaddebchdiga ggfb... |
correct output |
---|
23 |
user output |
---|
0 |
Test 31
Verdict: WRONG ANSWER
input |
---|
ghfhehdff dci icdehheefdih daf... |
correct output |
---|
248 |
user output |
---|
0 |
Test 32
Verdict: WRONG ANSWER
input |
---|
s a hzdgckekirkyo kirnflw anrx... |
correct output |
---|
27 |
user output |
---|
1 |
Test 33
Verdict: WRONG ANSWER
input |
---|
adcdbbb baac abbbcc c abccacd ... |
correct output |
---|
433 |
user output |
---|
0 |
Test 34
Verdict: WRONG ANSWER
input |
---|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... |
correct output |
---|
3427 |
user output |
---|
0 |
Test 35
Verdict: WRONG ANSWER
input |
---|
oezwsp pf z asgxlquafowjzpekpv... |
correct output |
---|
359 |
user output |
---|
0 |
Test 36
Verdict: WRONG ANSWER
input |
---|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... |
correct output |
---|
2126 |
user output |
---|
0 |
Test 37
Verdict: WRONG ANSWER
input |
---|
ifvbbjczpcnpk imqvlttkngpeqszx... |
correct output |
---|
395 |
user output |
---|
0 |
Test 38
Verdict: WRONG ANSWER
input |
---|
dbbdcbd cbcaabbabccddbb acbcdc... |
correct output |
---|
242 |
user output |
---|
0 |
Test 39
Verdict: WRONG ANSWER
input |
---|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... |
correct output |
---|
4287 |
user output |
---|
0 |
Test 40
Verdict: WRONG ANSWER
input |
---|
eeeabcbabhd cb ddebchdigaiggfb... |
correct output |
---|
15 |
user output |
---|
0 |
Test 41
Verdict: WRONG ANSWER
input |
---|
ghfhehdffdd i icdehheefd hadaf... |
correct output |
---|
431 |
user output |
---|
0 |
Test 42
Verdict: WRONG ANSWER
input |
---|
syadhzdgckekirkyow irnflwfanrx... |
correct output |
---|
8039 |
user output |
---|
0 |
Test 43
Verdict: WRONG ANSWER
input |
---|
adcdbbbbbaaccabb ccdccabcc cdb... |
correct output |
---|
9409 |
user output |
---|
0 |
Test 44
Verdict: WRONG ANSWER
input |
---|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... |
correct output |
---|
168696 |
user output |
---|
0 |