#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define ull unsigned long long
#define fi first
#define se second
#define ld long double
int n;
map<pair<char, char>, bool>ada;
bool sekip[1005];
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ada[{'2', 'a'}]=1;
ada[{'2', 'b'}]=1;
ada[{'2', 'c'}]=1;
ada[{'3', 'd'}]=1;
ada[{'3', 'e'}]=1;
ada[{'3', 'f'}]=1;
ada[{'4', 'g'}]=1;
ada[{'4', 'h'}]=1;
ada[{'4', 'i'}]=1;
ada[{'5', 'j'}]=1;
ada[{'5', 'k'}]=1;
ada[{'5', 'l'}]=1;
ada[{'6', 'm'}]=1;
ada[{'6', 'n'}]=1;
ada[{'6', 'o'}]=1;
ada[{'7', 'p'}]=1;
ada[{'7', 'q'}]=1;
ada[{'7', 'r'}]=1;
ada[{'7', 's'}]=1;
ada[{'8', 't'}]=1;
ada[{'8', 'u'}]=1;
ada[{'8', 'v'}]=1;
ada[{'9', 'w'}]=1;
ada[{'9', 'x'}]=1;
ada[{'9', 'y'}]=1;
ada[{'9', 'z'}]=1;
cin >> n;
vector<string>s(n+5);
string patokan;
for(int i=1;i<=n;++i) cin >> s[i];
cin >> patokan;
int ans=n;
for(int idx=0;idx < patokan.length();++idx){
for(int j=1;j<=n;++j){
if(sekip[j]) continue;
if(s[j].length() < patokan.length()){
sekip[j]=1;
--ans;
continue;
}
if(!ada[{patokan[idx], s[j][idx]}]){
--ans;
sekip[j];
}
}
}
cout << ans << '\n';
}
Compilation message
marko.cpp: In function 'int main()':
marko.cpp:47:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
47 | for(int idx=0;idx < patokan.length();++idx){
| ~~~~^~~~~~~~~~~~~~~~~~
marko.cpp:57:12: warning: statement has no effect [-Wunused-value]
57 | sekip[j];
| ~~~~~~~^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
4 |
Incorrect |
18 ms |
1356 KB |
Output isn't correct |
5 |
Incorrect |
2 ms |
448 KB |
Output isn't correct |
6 |
Incorrect |
3 ms |
460 KB |
Output isn't correct |
7 |
Incorrect |
5 ms |
844 KB |
Output isn't correct |
8 |
Incorrect |
17 ms |
1460 KB |
Output isn't correct |
9 |
Incorrect |
3 ms |
468 KB |
Output isn't correct |
10 |
Incorrect |
11 ms |
1104 KB |
Output isn't correct |