Submission #1183752

#TimeUsernameProblemLanguageResultExecution timeMemory
1183752InvMODMobitel (COCI14_mobitel)C++17
0 / 50
0 ms324 KiB
#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define gcd __gcd
#define sz(v) (int) v.size()
#define pb push_back
#define pi pair<int,int>
#define all(v) (v).begin(), (v).end()
#define compact(v) (v).erase(unique(all(v)), (v).end())
#define FOR(i, a, b) for(int i = (a); i <= (b); i++)
#define ROF(i, a, b) for(int i = (a); i >= (b); i--)
#define dbg(x) "[" #x " = " << (x) << "]"
///#define int long long

using ll = long long;
using ld = long double;
using ull = unsigned long long;

template<typename T> bool ckmx(T& a, const T& b){if(a < b) return a = b, true; return false;}
template<typename T> bool ckmn(T& a, const T& b){if(a > b) return a = b, true; return false;}

const int N = 2e5+5;
const ll MOD = 1e9+7;
const ll INF = 1e18;




void solve()
{
    vector<int> id(10);
    for(int i = 1; i <= 9; i++){
        cin >> id[i];
    }
    string s; cin >> s;

    map<int, string> mp;
    mp[2] = "abc", mp[3] = "def";
    mp[4] = "ghi", mp[5] = "jkl";
    mp[6] = "mno", mp[7] = "pqrs";
    mp[8] = "tuv", mp[9] = "wxyz";

    for(int i = 0, same = -1; i < sz(s); i++){
        for(int j = 2; j < 10; j++)if(id[j] != 1){
            int cnt = 0;
            for(const char &c : mp[id[j]]){
                ++cnt;
                if(s[i] == c){
                    if(j == same) cout << "#";
                    for(int z = 1; z <= cnt; z++){
                        cout << j;
                    }
                    same = j;
                }
            }
        }

    } cout << "\n";
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    #define name "InvMOD"
    if(fopen(name".INP", "r")){
        freopen(name".INP","r",stdin);
        freopen(name".OUT","w",stdout);
    }

    int t = 1; //cin >> t;
    while(t--) solve();
    return 0;
}

Compilation message (stderr)

mobitel.cpp: In function 'int main()':
mobitel.cpp:71:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   71 |         freopen(name".INP","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
mobitel.cpp:72:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   72 |         freopen(name".OUT","w",stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...