# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1183754 | InvMOD | Mobitel (COCI14_mobitel) | C++17 | 0 ms | 328 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 = 1; j <= 9; 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;
}
}
}
}
}
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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |