Submission #339174

# Submission time Handle Problem Language Result Execution time Memory
339174 2020-12-24T18:47:12 Z ammar2000 Mobitel (COCI14_mobitel) C++17
50 / 50
1 ms 384 KB
#include <bits/stdc++.h>

using namespace std;
string l[]={"2","22","222","3","33","333","4","44","444","5","55","555","6","66","666","7","77","777","7777","8","88","888","9","99","999","9999"};
map <int,int> mp;
string s;
int main()
{
    int a;
    for (int i=0;i<9;i++)
    {
        cin>>a;
        mp[a]=i+1;
    }
    cin>>s;
    for (int i=0;i<s.length();i++)
    {if (i&&l[s[i]-'a'][0]==l[s[i-1]-'a'][0])
    cout <<"#";
    //cout <<s[i]-'a'<<" " ;
    for (int g=0;g<l[s[i]-'a'].length();g++)
        cout <<mp[l[s[i]-'a'][g]-'0'];}
    return 0;
}

Compilation message

mobitel.cpp: In function 'int main()':
mobitel.cpp:16:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |     for (int i=0;i<s.length();i++)
      |                  ~^~~~~~~~~~~
mobitel.cpp:20:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |     for (int g=0;g<l[s[i]-'a'].length();g++)
      |                  ~^~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct