Submission #34591

#TimeUsernameProblemLanguageResultExecution timeMemory
345915ak0Mobitel (COCI14_mobitel)C++14
50 / 50
0 ms2180 KiB
/* ID: 5ak0 PROG: LANG: C++11 */ #include <bits/stdc++.h> #define fr first #define sc second #define pb push_back #define mpr make_pair using namespace std; typedef long long ll; typedef pair<int, int> pii; const int INF = 1e9 + 7; int x; map <int, int> mp; map <char, string> s; string str; int main(){ #ifndef SAKO //freopen(".in", "r", stdin); //freopen(".out", "w", stdout); #endif // SAKO ios_base::sync_with_stdio(0); for (int i = 1; i <= 9; ++i){ cin >> x; mp[x] = i; } s['a'] = "2"; s['b'] = "22"; s['c'] = "222"; s['d'] = "3"; s['e'] = "33"; s['f'] = "333"; s['g'] = "4"; s['h'] = "44"; s['i'] = "444"; s['j'] = "5"; s['k'] = "55"; s['l'] = "555"; s['m'] = "6"; s['n'] = "66"; s['o'] = "666"; s['p'] = "7"; s['q'] = "77"; s['r'] = "777"; s['s'] = "7777"; s['t'] = "8"; s['u'] = "88"; s['v'] = "888"; s['w'] = "9"; s['x'] = "99"; s['y'] = "999"; s['z'] = "9999"; cin >> str; for (int i = 0; i < str.size(); ++i){ if (i > 0) if (s[str[i - 1]][0] == s[str[i]][0]) cout << "#"; for (int j = 0; j < s[str[i]].size(); ++j) cout << mp[s[str[i]][0] - '0']; } return 0; }

Compilation message (stderr)

mobitel.cpp: In function 'int main()':
mobitel.cpp:62:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < str.size(); ++i){
                       ^
mobitel.cpp:66:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int j = 0; j < s[str[i]].size(); ++j)
                           ^
#Verdict Execution timeMemoryGrader output
Fetching results...