Submission #1087625

#TimeUsernameProblemLanguageResultExecution timeMemory
1087625nguyen31hoang08minh2003Mobitel (COCI14_mobitel)C++14
50 / 50
1 ms460 KiB
#include <set> #include <map> #include <cmath> #include <queue> #include <deque> #include <stack> #include <math.h> #include <bitset> #include <vector> #include <string> #include <cstdio> #include <cctype> #include <numeric> #include <fstream> #include <sstream> #include <cstdlib> #include <iomanip> #include <cassert> #include <cstring> #include <stdio.h> #include <string.h> #include <iterator> #include <iostream> #include <algorithm> #include <strings.h> #include <functional> #include <unordered_set> #include <unordered_map> #define fore(i, a, b) for (int i = (a), i##_last = (b); i < i##_last; ++i) #define fort(i, a, b) for (int i = (a), i##_last = (b); i <= i##_last; ++i) #define ford(i, a, b) for (int i = (a), i##_last = (b); i >= i##_last; --i) #define fi first #define se second #define pb push_back #define sz(x) ((int)(x).size()) #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() using namespace std; using ll = long long; using ld = long double; template<class A, class B> bool maxi(A &a, const B &b) {return (a < b) ? (a = b, true):false;}; template<class A, class B> bool mini(A &a, const B &b) {return (a > b) ? (a = b, true):false;}; typedef unsigned long long ull; typedef pair<int, int> ii; typedef vector<int> vi; typedef vector<ii> vii; typedef vector<vi> vvi; typedef vector<vii> vvii; int keys[10], inverse[10]; pair<char, int> what[256]; string word, content[10] = {"", "", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"}; signed main() { #ifdef LOCAL freopen("input.INP", "r", stdin); #endif // LOCAL cin.tie(0) -> sync_with_stdio(0); cout.tie(0); fort(i, 1, 9) { cin >> keys[i]; inverse[keys[i]] = i; } fort(d, 0, 10) fore(j, 0, content[d].size()) what[content[d][j]] = make_pair(j + 1, inverse[d] + '0'); cin >> word; fore(i, 0, word.size()) { if (i == 0) { cout << string(what[word[i]].first, what[word[i]].second); continue; } if (what[word[i - 1]].second == what[word[i]].second) cout << '#'; cout << string(what[word[i]].first, what[word[i]].second); } cout << '\n'; return 0; }

Compilation message (stderr)

mobitel.cpp: In function 'int main()':
mobitel.cpp:71:31: warning: array subscript has type 'char' [-Wchar-subscripts]
   71 |             what[content[d][j]] = make_pair(j + 1, inverse[d] + '0');
      |                               ^
mobitel.cpp:77:40: warning: array subscript has type 'char' [-Wchar-subscripts]
   77 |             cout << string(what[word[i]].first, what[word[i]].second);
      |                                        ^
mobitel.cpp:77:61: warning: array subscript has type 'char' [-Wchar-subscripts]
   77 |             cout << string(what[word[i]].first, what[word[i]].second);
      |                                                             ^
mobitel.cpp:80:29: warning: array subscript has type 'char' [-Wchar-subscripts]
   80 |         if (what[word[i - 1]].second == what[word[i]].second)
      |                             ^
mobitel.cpp:80:53: warning: array subscript has type 'char' [-Wchar-subscripts]
   80 |         if (what[word[i - 1]].second == what[word[i]].second)
      |                                                     ^
mobitel.cpp:82:36: warning: array subscript has type 'char' [-Wchar-subscripts]
   82 |         cout << string(what[word[i]].first, what[word[i]].second);
      |                                    ^
mobitel.cpp:82:57: warning: array subscript has type 'char' [-Wchar-subscripts]
   82 |         cout << string(what[word[i]].first, what[word[i]].second);
      |                                                         ^
#Verdict Execution timeMemoryGrader output
Fetching results...