Submission #713864

# Submission time Handle Problem Language Result Execution time Memory
713864 2023-03-23T06:30:32 Z ALTAKEXE Marko (COCI15_marko) C++14
50 / 50
25 ms 1620 KB
#include<bits/stdc++.h>
using namespace std;
int n;
map<pair<char, char>, bool>a;
bool sekip[1005];
int main()
{
    a[{'2', 'a'}]=1;
    a[{'2', 'b'}]=1;
    a[{'2', 'c'}]=1;
    a[{'3', 'd'}]=1;
    a[{'3', 'e'}]=1;
    a[{'3', 'f'}]=1;
    a[{'4', 'g'}]=1;
    a[{'4', 'h'}]=1;
    a[{'4', 'i'}]=1;
    a[{'5', 'j'}]=1;
    a[{'5', 'k'}]=1;
    a[{'5', 'l'}]=1;
    a[{'6', 'm'}]=1;
    a[{'6', 'n'}]=1;
    a[{'6', 'o'}]=1;
    a[{'7', 'p'}]=1;
    a[{'7', 'q'}]=1;
    a[{'7', 'r'}]=1;
    a[{'7', 's'}]=1;
    a[{'8', 't'}]=1;
    a[{'8', 'u'}]=1;
    a[{'8', 'v'}]=1;
    a[{'9', 'w'}]=1;
    a[{'9', 'x'}]=1;
    a[{'9', 'y'}]=1;
    a[{'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(!a[{patokan[idx], s[j][idx]}]){
                --ans;
                sekip[j]=1;
            }
        }
    }
    cout << ans << '\n';
    return 0;
}

Compilation message

marko.cpp: In function 'int main()':
marko.cpp:40:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |     for(int idx=0;idx < patokan.length();++idx){
      |                   ~~~~^~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 20 ms 1476 KB Output is correct
5 Correct 3 ms 468 KB Output is correct
6 Correct 3 ms 340 KB Output is correct
7 Correct 9 ms 952 KB Output is correct
8 Correct 25 ms 1620 KB Output is correct
9 Correct 4 ms 468 KB Output is correct
10 Correct 16 ms 1136 KB Output is correct