# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
153719 | BabinSinko | Marko (COCI15_marko) | C++14 | 35 ms | 1400 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <cctype>
#include <ctime>
#include <string>
#include <vector>
using namespace std;
long long n, x, sol, l;
vector <string> w;
string s, a;
int main(){
cin >> n;
for (int i = 0; i < n; i++){
cin >> a;
w.push_back(a);
}
cin >> s;
sol = n;
l = s.length();
for (int i = 0; i < l; i++){
if (s[i] == '2'){
for (int j = 0; j < n; j++){
if (w[j][i] != 'a' and w[j][i] != 'b' and w[j][i] != 'c'){
w.erase(w.begin() + j);
n = n - 1;
j = j - 1;
}
}
}
if (s[i] == '3'){
for (int j = 0; j < n; j++){
if (w[j][i] != 'd' and w[j][i] != 'e' and w[j][i] != 'f'){
w.erase(w.begin() + j);
n = n - 1;
j = j - 1;
}
}
}
if (s[i] == '4'){
for (int j = 0; j < n; j++){
if (w[j][i] != 'g' and w[j][i] != 'h' and w[j][i] != 'i'){
w.erase(w.begin() + j);
n = n - 1;
j = j - 1;
}
}
}
if (s[i] == '5'){
for (int j = 0; j < n; j++){
if (w[j][i] != 'j' and w[j][i] != 'k' and w[j][i] != 'l'){
w.erase(w.begin() + j);
n = n - 1;
j = j - 1;
}
}
}
if (s[i] == '6'){
for (int j = 0; j < n; j++){
if (w[j][i] != 'm' and w[j][i] != 'n' and w[j][i] != 'o'){
w.erase(w.begin() + j);
n = n - 1;
j = j - 1;
}
}
}
if (s[i] == '7'){
for (int j = 0; j < n; j++){
if (w[j][i] != 'p' and w[j][i] != 'q' and w[j][i] != 'r' and w[j][i] != 's'){
w.erase(w.begin() + j);
n = n - 1;
j = j - 1;
}
}
}
if (s[i] == '8'){
for (int j = 0; j < n; j++){
if (w[j][i] != 't' and w[j][i] != 'u' and w[j][i] != 'v'){
w.erase(w.begin() + j);
n = n - 1;
j = j - 1;
}
}
}
if (s[i] == '9'){
for (int j = 0; j < n; j++){
if (w[j][i] != 'w' and w[j][i] != 'x' and w[j][i] != 'y' and w[j][i] != 'z'){
w.erase(w.begin() + j);
n = n - 1;;
j = j - 1;
}
}
}
}
cout << n;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |