Submission #397552

#TimeUsernameProblemLanguageResultExecution timeMemory
397552AlmaMobitel (COCI14_mobitel)C++17
50 / 50
1 ms316 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); unordered_map<int, int> puddle; int key; for (int i = 1; i <= 9; i++) { cin >> key; puddle[key] = i; } string s; cin >> s; int pre = 0; for (char c: s) { int act = c - 'a' + 1; if (1 <= act && act <= 3) { // a b c if (1 <= pre && pre <= 3) cout << '#'; pre = act; for (int i = 1; i <= act; i++) cout << puddle[2]; } if (4 <= act && act <= 6) { // d e f if (4 <= pre && pre <= 6) cout << '#'; pre = act; for (int i = 4; i <= act; i++) cout << puddle[3]; } if (7 <= act && act <= 9) { // g h i if (7 <= pre && pre <= 9) cout << '#'; pre = act; for (int i = 7; i <= act; i++) cout << puddle[4]; } if (10 <= act && act <= 12) { // j k l if (10 <= pre && pre <= 12) cout << '#'; pre = act; for (int i = 10; i <= act; i++) cout << puddle[5]; } if (13 <= act && act <= 15) { // m n o if (13 <= pre && pre <= 15) cout << '#'; pre = act; for (int i = 13; i <= act; i++) cout << puddle[6]; } if (16 <= act && act <= 19) { // p q r s if (16 <= pre && pre <= 19) cout << '#'; pre = act; for (int i = 16; i <= act; i++) cout << puddle[7]; } if (20 <= act && act <= 22) { // t u v if (20 <= pre && pre <= 22) cout << '#'; pre = act; for (int i = 20; i <= act; i++) cout << puddle[8]; } if (23 <= act && act <= 26) { // w x y z if (23 <= pre && pre <= 26) cout << '#'; pre = act; for (int i = 23; i <= act; i++) cout << puddle[9]; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...