Submission #364961

# Submission time Handle Problem Language Result Execution time Memory
364961 2021-02-10T15:47:27 Z maozkurt Mobitel (COCI14_mobitel) C++17
50 / 50
1 ms 364 KB
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <stack>
#include <numeric>
#include <cassert>

#define endl '\n'
#define sp ' '

#define pb push_back
#define mp make_pair
#define ff first
#define ss second

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

string org[] = { 
    "",
    "", "abc", "def",
    "ghi", "jkl", "mno",
    "pqrs", "tuv", "wxyz"
};

int main(){
    
    ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);cerr.tie(nullptr);
    
    map<char,string> mm;
    for(int i=1;i<=9;i++){
        int cur;cin>>cur;
        for(int j=0;j<org[cur].size();j++){
            for(int k=0;k<=j;k++)
                mm[org[cur][j]] += (char)i + '0';
        }
    }
    string msg;cin>>msg;
    int n = msg.size();
    for(int i=0;i<n;i++){
        cout << mm[msg[i]];
        if(i+1<n && mm[msg[i+1]][0] == mm[msg[i]][0])
            cout << '#';
    }
    cout << endl;
    
}











Compilation message

mobitel.cpp: In function 'int main()':
mobitel.cpp:45:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |         for(int j=0;j<org[cur].size();j++){
      |                     ~^~~~~~~~~~~~~~~~
# 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 364 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