Submission #999563

#TimeUsernameProblemLanguageResultExecution timeMemory
999563May27_thMobitel (COCI14_mobitel)C++17
0 / 50
1 ms348 KiB
#include<bits/stdc++.h> using namespace std; #define int64_t long long #define mp make_pair #define pb push_back #define all(x) (x).begin(), (x).end() int N, M; void Solve(void) { vector<int> lab(12); for (int i = 1; i <= 9; i ++) { int x; cin >> x; lab[x] = i; } string letter; cin >> letter; string text = ""; int number = 2; vector<string> to(30); for (int a = 0; a < 15; a ++) { text = text + char(number + '0'); to[a] = text; if ((int)text.size() == 3) { text = ""; number ++; } } to[15] = "7", to[16] = "77", to[17] = "777", to[18] = "7777"; to[19] = "8", to[20] = "88", to[21] = "888"; to[22] = "9", to[23] = "99", to[24] = "999", to[25] = "9999"; bool flag = false; for (int i = 0; i < (int)letter.size(); i ++) { int c = letter[i] - 'a'; if (i) { int d = letter[i - 1] - 'a'; if (d/3 == c/3) { if (!flag) cout << "#"; flag = true; } } for (auto x : to[c]) { cout << lab[x - '0']; // cout << x; } } } signed main() { ios_base::sync_with_stdio(false); cin.tie(0); int Tests = 1; // cin >> Tests; while (Tests --) { Solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...